The CASE construct provides an alternative to an IF construct containing
multiple ELSEIFs. It takes the general form:
. . .
CASE constructs can be named.
The expression provides a value upon which the selection is based and
must be a scalar of type INTEGER, LOGICAL or CHARACTER.
CASE DEFAULT is optional and is not necessarily placed last. It provides for the
situation where none of the given CASEs applies.
The case_selector values must be of the same type as expression.
They contain a single constant value or a list of constant values. Ranges may
also be used. For example:
!Month and Days are of type INTEGER
!Month has been assigned a value.
!Code to test for a leap year
!Code to flag an error
A range takes the form CASE(low: high) where low or high
(but not both) may be omitted. For example, if high is omitted then the
condition becomes expression>low. For example:
Sign=-1 !if n<0
Sign=0 !if n=0
Sign=1 !if n>0
Each case must be unique with no possible overlap.
In the case of a CHARACTER expression, it may represent a single
character or a character string.