Switch branching ($SWITCH )
SWITCH branching permits the processing of various NC program variants as a function of an arithmetic expression.
The control statements $SWITCH, $CASE, $DEFAULT, $ENDSWITCH are used for branching..
| Syntax: | 
Branching always starts with:
| $SWITCH <expr1> | 
followed by several
| $CASE <expr2> | 
| ... | 
| $BREAK | 
optionally followed by:
| $DEFAULT | 
and always ends with
| $ENDSWITCH | 
Programing Example

SWITCH branching
N100 $SWITCH P1=INT [P1*P2/P3] If the result of the arithmetical
expression is equal to 1, the
N110 $CASE 1 blocks after $CASE 1 are executed (N120-140)
N120 ...
N130
N140 $BREAK
N150 $CASE P2                  If the result is equal to P2, the blocks 
                               N160 ..N170 are executed.
N160 ...
N170 $BREAK
N300 $CASE n
N320 ...
N330 $BREAK
N350 $DEFAULT                  The $DEFAULT block is optional and is used to 
                               execute the NC blocks N360-N380
N360 ... if the result of the $SWITCH block
N370 does not match any of the $CASE cases.
N380
N390 $ENDSWITCH
Notice

The expressions <expr1> and <expr2> are compared using the internal REAL mode. Here, both expressions are evaluated as equal if the value difference is < 0.001.
The expressions <expr1> and <expr2> can also assume negative values.