The IF command has one prompt:
| Valid Relational operators | |
= |
(equal) |
>< & <> |
(not equal) |
< |
(less than) |
> |
(greater than) |
<= & =< |
(less than or equal to) |
>= & => |
(greater than or equal to) |
Only the simplest logical operators are provided. Note that for now the logical
NOT (~) and arithmetic unary minus
(-) are the same thing, but I do not guarantee that this will continue,
and in any case, expressions are easier to use if you distinguish between the
two uses. The two binary operators (& and !)
have the same precedence, but lower than that of any of the relational
operators. Expressions are evaluated left to right.
| Valid Logical operators | |
& |
AND |
! |
OR |
~ |
NOT |
The expression may optionally be enclosed in brackets for readability.
If the expression encountered by an IF or ELSEIF statement is logically true then the following commands to the next ELSEIF/ELSE or ENDIF will be executed and any further commands before the ENDIF ignored; otherwise they will be skipped until the next ELSEIF which is treated like a new IF. If an ELSE statement is encountered without any of the tests on the IF or any following ELSEIFs having been true the commands following the ELSE are executed. IF structures can be nested to a depth of 16.
Example:
! Command file to demonstrate IF command
if 3*x^2+4 <= 27
offset x
elseif (x/4 = 2)
x = 27
else
print 'nothing done'
endif