Transferring control

The topic describes the actions to take when conditions tested is true or false.

If the condition tested is true, one of the following actions takes place:

  • If statement-1 is specified, statement-1 is executed. If statement-1 contains a procedure branching or conditional statement, control is transferred according to the rules for that statement. If statement-1 does not contain a procedure-branching statement, the ELSE phrase, if specified, is ignored, and control passes to the next executable statement after the corresponding END-IF or separator period.
  • If NEXT SENTENCE is specified, control passes to an implicit CONTINUE statement immediately Start of changefollowingEnd of change the next separator period.

If the condition tested is false, one of the following actions takes place:

  • If ELSE statement-2 is specified, statement-2 is executed. If statement-2 contains a procedure-branching or conditional statement, control is transferred, according to the rules for that statement. If statement-2 does not contain a procedure-branching or conditional statement, control is passed to the next executable statement after the corresponding END-IF or separator period.
  • If ELSE NEXT SENTENCE is specified, control passes to an implicit CONTINUE STATEMENT immediately preceding the next separator period.
  • If neither ELSE statement-2 nor ELSE NEXT SENTENCE is specified, control passes to the next executable statement after the corresponding END-IF or separator period.

When the ELSE phrase is omitted, all statements following the condition and preceding the corresponding END-IF or the separator period for the sentence are considered to be part of statement-1.