if ... then ... end if
Conditionally execute code.
Syntax:
if condition
expression then
commands to be executed
if condition is true
end if
The if
statement allow the
execution of certain operations only if determinate conditions are
true, this allow your program to make decisions.
To make decision the if statement evaluate the condition expression
that is any expression that results in either true or false
, for example: 5>1=true or 10<3=false
If the expression is true the commands between statement then and
statement end if will be executed otherwise, if the expression is
false, it will be skipped.
Example:
for n = 1 to 20
a=rnd(10)
print a
if a>5 then
print "random number is greater than
five"
end if
next
See also else, elseif, and, or, not and xor commands.