|
VMS Help CC, Language topics, Statements, switch *Conan The Librarian |
The switch statement executes one or more of a series of cases,
based on the value of an integer expression.
Syntax:
switch ( expression ) body
The switch's body typically is a block, within which any statement
can be prefixed with one or more case labels as follows:
case constant-expression :
At most one statement in the body may have the label as follows:
default :
The switch expression is evaluated and compared to the cases. If
there is a case matching the expression's value, it is executed; if
not, the default case is executed. The switch is normally
terminated by a break, return, or goto statement in one of the
cases. If there is no matching case and no default, the body of
the switch statement is skipped.
|
|