Skip to content

$if

$if will check a condition and return either true or false depending on the condition being true or false.

Usage

$if[condition;true;false?]

Parameters

FieldTypeDescriptionRequired
conditionstringCondition to check.true
truestringWhat to return when the condition is true.true
false?stringWhat to return when the condition is false.false

Valid Mathematical Operators

OperatorMathematical Expression
==equal to
!=not equal to
<=less than or equal to
>=greater than or equal to
>greater than
<less than
||logical OR
&&logical AND

Example(s)

This will return That's false! as 1 doesn’t equal 2:

1
client.command({
2
name: "if",
3
code: `
4
$if[1==2;That's true!;That's false!]
5
`
6
});

This will do the exact same just different usage of $if by using $if: "old":

1
client.command({
2
name: "if",
3
$if: "old",
4
code: `
5
$if[1==2]
6
That's true!
7
$else
8
That's false!
9
$endif
10
`
11
});