IF...THEN...ELSE... executes either of two statements as the result of an expression.
IF (expression) THEN (statement1) [ELSE (statement2)]
IF A=B THEN X=10 ELSE A=A+1 IF D AND NOT B THEN C=0:GOTO 50 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 (i.e. A=6) and cause A to be incremented if A=6 and B>10.
The expression must be able to be evaluated true or false. 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 allowed when using IF...THEN...ELSE.