The IF statement is used to allow other statements to be conditionally executed.
IF expression THEN|ELSE statements
The expression will be evaluated to a value of Boolean TRUE or FALSE. If the expression is TRUE then the statements defined by the THEN clause will be executed (if present). If the expression is FALSE then the statements defined by the ELSE clause are executed.
The THEN and ELSE clauses may take two different forms being single and multiple line statements.
The simplest form of either clause is of the form:
IF A THEN CRT A
IF A ELSE CRT A
but the clauses may be expanded to enclose multiple lines of code using the END keyword as so:
IF A THEN
The single and multi-line versions of either clause may be combined to make complex combinations of the command. For reasons of readability it is suggested that where both clauses are present for an IF statement that the same form of each clause is coded.
IF statements can be nested within either clause to any number of levels.