IF
operator evaluates one or more conditions and creates a new branch of code.00d6: if <N>
<condition 1>
<condition 2>
...
<condition N+1>
004D: jump_if_false <label>
N
means the total number of conditions within the IF statement and the way the evaluation of conditions happens. AND
(all conditions must be true for the IF statement to be true)OR
(at least one of the conditions must be true for the IF statement to be true)0
after IF. IF 0
and IF
are equivalent.<label>
- a name of the label where script jumps if the IF statement is false.
<condition>
- any conditional opcode evaluating to true
or false
Conditions check
enabled in the options, you can replace the if number with the keywords AND
or OR
. The compiler calculates the correct value itself.1
instead of and
.IF AND
- conditions connected with the logical operator AND
(a replacement for if 1..7
)
IF OR
- conditions connected with the logical operator OR
(a replacement for if 21..27
)IF <N>/AND/OR
<condition 1>
<condition 2>
...
<condition N+1>
THEN
<commands if the statement is true>
END
IF <N>/AND/OR
<condition 1>
<condition 2>
...
<condition N+1>
THEN
<commands if the statement is true>
ELSE
<commands if the statement is false>
END
THEN
you have to specify the command(-s) that are executed if the condition is met. After ELSE
you have to specify the command(-s) that are executed if the condition is not met.IF
statement is closed with the word END
.==
b - a is equal to b >=
b - a is greater than or equal to b >
b - a is greater than b <
b - a is less than b <=
b - a is less than or equal to b <>
b - a is not equal to ba
and b
are operands. The compiler is able to figure out an opcode if one of the operands is a number or a string literal, or both variable' type is known.