$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
Field | Type | Description | Required |
---|---|---|---|
condition | string | Condition to check. | true |
true | string | What to return when the condition is true. | true |
false? | string | What to return when the condition is false. | false |
Valid Mathematical Operators
Operator | Mathematical 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
:
1client.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"
:
1client.command({2 name: "if",3 $if: "old",4 code: `5 $if[1==2]6 That's true!7 $else8 That's false!9 $endif10 `11});