BASIC FUNCTIONS
SECTION 5.10
IF .. THEN .. ELSE
5.10.2 Function IF .•• THEN ..• ELSE, •• executes either of two
statements as the result of an expression.
Syntax
IF (expression) THEN (statement1) [ELSE (statement) 2]
Examples IF A=B THEN X=10 ELSE A=A+1
IF D AND NOT B THEN C:O:GOT050 ELSE RETURN
Multiple statements separated with colons are implemented
or skipped depending on the condition.
IF A:6 THEN IF B>10 THEN A:0 ELSE ELSE A=A+1
Omitting the first ELSE will
move processing straight onto
the next line if the first condition is false (ie A=6) and
cause A to be incremented if A=6 and B>10.
Remarks The expression must be able to be evaluated true or false.
VER.V09F
If the expression is true then statement 1 is executed, and
if false statement 2 is executed,
The statement may include other conditional statements
(nested), but care must be exercised in the positioning of
ELSE to associate them with the correct IF. Generally,
each ELSE is associated with the most recent IF.· Extra
ELSE statements causing no action at the end of the line
may be omitted.
The use of logical operators outlined in the section
relating to 'IF' are also allo1,ed when using
IF ... THEN ... ELSE.
PAGE 5 - 44