IF (expression1) statement-block ELSEIF (expression2) statement-block ELSEIF (expression-n) statement-block ELSE statement-block ENDIF |
ELSEIF and ELSE portions are optional. |
A statement-block is zero or more statements. Variables can be declared here, and will go out of scope when the statement-block is exited.
Note, this construct uses fully bracketed syntax.
IF (a < 5) print "hey"; ENDIF |
|
IF (a < 5) print "hey"; print "hey again"; ENDIF |
|
IF (a < 5) print "hey"; print "hey again"; ELSE print "or not"; ENDIF |
|
IF (a < 5) print "a is small"; ELSEIF (a < 10) print "a is not so small"; ELSE print "a is large"; ENDIF |
|
IF (a < 5) print "a is small"; ELSEIF (a < 10) print "a is not so small"; ENDIF |
Note the absence of an ELSE clause |