Examples of IF Statements

In the following example, if ALLDONE is TRUE, control is transferred to the statement with the label AWAY. If ALLDONE is FALSE, the statement following the IF statement is executed.

IF ALLDONE THEN
   GO AWAY

In the following example, if the value of X is greater than the value of LIMIT, procedure ERROR is called. If the value of X is less than or equal to the value of LIMIT, the value of X is incremented by 1. In either case, execution continues with the statement following the IF statement.

IF X > LIMIT THEN
   ERROR
ELSE
   X := * + 1