4.2. CASE


        CASE expr OF
          cexpr1[',' cexpr1a...] ':' statement
          [ cexpr2[',' cexpr2a...] ':' statement ]
          [ OTHERWISE statement ]
        END CASE

expr is evaluated and compared against each cexpr listed. If a match occurs, the statement to the right of the matching cexpr is executed. If no match occurs, the statement after OTHERWISE is executed. If there is no OTHERWISE, control continues after END CASE. Unlike Pascal, the behavior is completely defined if there is no matching expression.

Unlike C (but like Pascal) there is no explicit break. After a statement is processed, control proceeds past the END CASE.

Each cexpr must evaluate to a unique value.


        CASE xx OF
          1:     yy = 3
          2,5,7: yy = 4
          10:    BLOCK
                   yy = 5
                   zz = 6
                 END BLOCK
          OTHERWISE zz = 0
        END CASE
Note that only one statement is allowed in each case, thus the reason for BLOCK as BLOCK...END BLOCK is considered a single statement.