IF
Command: #if {conditional} {commands if true} {commands if false}
The #if command works similar to an if statement in other languages,
and is based on the way C handles its conditional statements.
When an #if command is encountered, the conditional statement is
evaluated, and if TRUE (any non-zero result) the commands are executed.
The conditional is evaluated exactly the same as in the #math command,
if the conditional evaluates as anything except 0 the commands are
executed. See the 'math' helpfile for more information.
To handle the case where an if statement is false it can be followed
by the #else command. Alternatively, the else can be provided as the
third argument.
Example: #action {%0 gives you %1 gold coins.} {#if {%1 > 5000} {thank %0}}
If someone gives you more than 5000 coins, thank them.
Example: #alias {k} {#if {"%0" == ""} {kill $target};#else {kill %0}}
Example: #if {"%0" == "{bli|bla}"} {#showme %0 is either bli or bla.}
Related: case, default, else, elseif, math, switch and regexp.
|