ELSEIF (Else If)

Free-Form Syntax ELSEIF{(MR)} indicator-expression
Code Factor 1 Extended Factor 2
ELSEIF (M/R) Blank indicator-expression

The ELSEIF operation is the combination of an ELSE operation and an IF operation. It avoids the need for an additional level of nesting.

The IF operation code allows a series of operation codes to be processed if a condition is met. Its function is similar to that of the IFxx operation code. It differs in that the logical condition is expressed by an indicator valued expression (indicator-expression). The operations controlled by the ELSEIF operation are performed when the expression in the indicator-expression operand is true (and the expression for the previous IF or ELSEIF statement was false).

For information on how operation extenders M and R are used, see Precision Rules for Numeric Operations.

For more information, see Structured Programming Operations.

Figure 312. ELSEIF Operation
 *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
 /free

    IF keyPressed = HELPKEY;
       displayHelp();
    ELSEIF keyPressed = EXITKEY;
       return;
    ELSEIF keyPressed = ROLLUP OR keyPressed = ROLLDOWN;
       scroll (keyPressed);
    ELSE;
       signalError ('Key not defined');
    ENDIF;

 /end-free


[ Top of Page | Previous Page | Next Page | Contents | Index ]