Next: , Previous: External Values, Up: Project File Reference


13.12 Case Construction

A case construction supports attribute and variable declarations that depend on the value of a previously declared variable.

Syntax:

     case_construction ::=
       case <typed_variable_>name is
         {case_item}
       end case ;
     
     case_item ::=
       when discrete_choice_list =>
         {case_construction |
           attribute_declaration |
           variable_declaration |
           empty_declaration}
     
     discrete_choice_list ::=
       string_literal {| string_literal} |
         others

Inside a case construction, variable declarations must be for variables that have already been declared before the case construction.

All choices in a choice list must be distinct. The choice lists of two distinct alternatives must be disjoint. Unlike Ada, the choice lists of all alternatives do not need to include all values of the type. An others choice must appear last in the list of alternatives.