[ Back ]
Logic expressions
If and then
If and endif
If, else and endif
If, elseif, else and endif
With the different versions of the selection statement (the if statement, that is), you can use logic expressions to control the program flow.
A logic expression can use the following operators:
Symbol | Example | Meaning |
= | a = b | true if expression a is equal to expression b |
<> | a <> b | true if a is not equal to be |
< | a < b | true if a is less than b |
> | a > b | true if a is greater than b |
<= | a <= b | true if a is less than or equal to b |
>= | a >= b | true if a is greater than or equal to b |
and | a and b | true if expression a and b are both true |
or | a or b | true if expression a, b or both are true |
During evaluation the operators have the following priorities (highest first):
*
/, %
+, -
=, <>, <, >, <=, >=
and, or
, where % is the modulus operator. But, of course, parenthesis can be used to force precendence.
if logic expr then statement
If the logic expression evaluates to true, the one statement is performed.
if logic expr
statement
...
endif
If the logic expression evaluates to true, all the statements between the if and endif lines are performed.
if logic expr
statement
...
else
statement
...
endif
If the logic expression evaluates to true, the statements between the if and else lines are performed, else the statements between else and endif are performed.
if logic expr
statement
...
elseif logic expr
statement
...
...
[else
statement
...]
endif
If the first expression evaluates to true, the statements between if and elseif are performed. Else the second expression is evaluated to se if the lines between elseif and another elseif, else or endif are to be performed.
[ Back ]