[top] [prev] [next]

Case

A CASE statement has the form:

    CASE Expr OF  
      L_1 => S_1 
    | ...
    | L_n => S_n
    ELSE S_0 
    END
where Expr is an expression whose type is an ordinal type and each L is a list of constant expressions or ranges of constant expressions denoted by "e_1..e_2", which represent the values from e_1 to e_2 inclusive. If e_1 exceeds e_2, the range is empty. It is a static error if the sets represented by any two L's overlap or if the value of any of the constant expressions is not a member of the type of Expr. The "ELSE S_0" is optional.

The statement evaluates Expr. If the resulting value is in any L_i, then S_i is executed. If the value is in no L_i and "ELSE S_0" is present, then it is executed. If the value is in no L_i and "ELSE S_0" is absent, a checked runtime error occurs.

[top] [prev] [next]