High level language
153
$SWITCH
$CASE
$ENDSWITCH
$BREAK
$DEFAULT
Conditional execution SWITCH.
$SWITCH <expression1>
$SWITCH <expression2>
$ENDSWITCH
$BREAK
$DEFAULT
Note: this instruction calculates the result
of <expression1> and executes the blocks
contained between the $CASE instruction,
whose <expression2> has the same value
as the calculated result and the
corresponding $BREAK instruction.
The $SWITCH instruction always ends with
a $ENDSWITCH.
The $CASE instruction always ends with a
$BREAK. As many $CASE instructions as
necessary may be programmed.
As an option, a $DEFAULT instruction may
be inserted in such a way that if the result
of <expression1> does not coincide with
the value of any <expression2>, it executes
the blocks contained between $DEFAULT
and $ENDSWITCH.
E.g.:
$SWITCH [P1=P2/P3]
$CASE 10
… (executes this section if P1=10)
$BREAK
$CASE 20
… (executes this section if P1=20)
$BREAK
$CASE 40
… (executes this section if P1=40)
$BREAK
$DEFAULT
… (executes this section for other P1 values)
$ENDSWITCH
Instruction Meaning