[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
case expression of selector: statement; ... selector: statement; end |
case ordinal expression of selector: statement; ... selector: statement; otherwise { ``else'' instead of ``otherwise'' allowed } statement; ... statement; end |
record
type definition:
type foo = record field declarations case bar: variant type of selector: (field declarations); selector: (field declarations); ... end; |
type foo = record field declarations case variant type of selector: (field declarations); selector: (field declarations); ... end; |
The case
statement compares the value of ordinal expression
to each selector, which can be a constant, a subrange, or a list of
them separated by commata, being compatible with the result of
ordinal expression.
Note: duplicate selectors or range crossing is not allowed unless
{$borland-pascal} is specified. In case of
equality the corresponding statement is executed. If otherwise
is specified and no appropriate selector matched the expression, the
series of statements following otherwise
is executed. As a synonym
for otherwise
, else
can be used. The semicolon before
otherwise
is optional.
@@ ???? The expression must match one of the selectors in order to continue, unless an alternative statement series is specified.
For case
in a variant record type definition, see section 8.2.10.4 Record Types.