Return to Statement


Block IF Example 2

The following example contains a BLOCKIF construct using both the ELSEIF and ELSE statements.

   IFTHEN/a > b
MESSG/'ARRAY A IS GREATER THAN ARRAY B'
ELSEIF/a < b
MESSG/'ARRAY A IS LESS THAN ARRAY B'
ELSE
MESSG/'ARRAY A IS EQUAL TO ARRAY B'
ENDIF

In this case, if the value of a is greater than b, the program displays the message ARRAY A IS GREATER THAN ARRAY B. If the value of a is less than b, the program displays the message ARRAY A IS LESS THAN ARRAY B. But if neither case is true (the value of a is equal to b), then the program displays the message ARRAY A IS EQUAL TO ARRAY B.