TAL Reference Manual
Statements
TAL Reference Manual—526371-001
12-12
Usage Considerations
case-label
is a signed INT constant or LITERAL. Each case-label must be unique in the
CASE statement.
lower-case-label
is the smallest value in an inclusive range of signed INT constants or
LITERALs.
upper-case-label
is the largest value in an inclusive range of signed INT constants or LITERALs.
statement
is any statement described in this section.
OTHERWISE
specifies an optional sequence of statements to execute if selector does not select
any
case-alternative. If no OTHERWISE clause is present and selector does not
match a
case-alternative, a run-time error occurs. Always include an OTHERWISE
clause, even if it contains no
statements.
Usage Considerations
The TAL Programmer’s Guide describes efficiency guidelines and execution of the
labeled CASE statement.
Example of Labeled CASE Statement
This labeled CASE statement has four case alternatives and the OTHERWISE case:
INT location;
LITERAL bay_area, los_angeles, hawaii, elsewhere;
PROC area_proc (area_code); !Declare procedure
INT area_code; !Declare selector as
BEGIN ! formal parameter
CASE area_code OF !Selector is AREA_CODE
BEGIN
408, 415 ->
location := bay_area;
case-label ->
statement
lower-case-
label
. .
upper-
case-label
,
;
VST1208.vsd