4.2. CASE

Syntax:


        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.