HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
CASE
Chapter 10 293
CASE
Marks start of statement block in a CASE construct.
Syntax
CASE (
case-selector
) [
construct-name
]
case-selector
is a comma-separated list of ranges of values that are candidates for
matching against the case index specified by the SELECT CASE statement.
Each item in the list can take one of the following forms:
case-value
low
:
•:
high
low
:
high
DEFAULT
where:
case-value
,
low
, and
high
are scalar initialization expressions of type integer, character, or logical
DEFAULT
indicates the statement block to execute if none of the other CASE
statements in the CASE construct produces a match.
construct-name
is the name given to the CASE construct.
Description
The CASE statement is used in a CASE construct to mark the start of a statement block. The
CASE construct can consist of multiple blocks; at most, one is selected for execution. Selection
is determined by comparing the case index produced by the SELECT CASE statement to the
case-selector
in each CASE statement. If a match is found, the statement block under the
matching
case-selector
executes. A match between the case index (
c
) and
case-selector
is determined for each form of
case-selector
, as follows:
case-value
For integer and character types, a match occurs if
c
.EQ.
case-value
.
For logical types, a match occurs if
c
.EQV.
case-value
.