Else

Examples of Else

GT.M executes the remainder of the line after the ELSE if $TEST is FALSE (0). GT.M does not execute the rest of the line if $TEST is TRUE (1).

The format of the ELSE command is:

        E[LSE]
      

Because the scopes of both the IF and the ELSE commands extend to the rest of the GT.M line, placing an ELSE on the same line as the corresponding IF cannot achieve the desired result. If an ELSE were placed on the same line as its corresponding IF, then the expression tested by the IF would be either TRUE or FALSE. If the condition is TRUE, the code following the ELSE would not be executed. If the condition is FALSE, the ELSE and everything following it would not be executed.

ELSE is analogous to IF '$TEST, except the latter statement switches $TEST to its complement and ELSE never alters $TEST.

The scope of an ELSE can be extended with DO or XECUTE commands.

[Caution]

Use ELSE with caution. Because GT.M stacks $TEST only at the execution of an extrinsic or an argumentless DO command, any XECUTE or DO with an argument has the potential side effect of altering $TEST. For information about $TEST, refer to the "Intrinsic Special Variables" chapter in this manual.