# Loops and branches

## Control structures

Control structures with positioning of the file pointer in backward direction (loops) are not permitted. This type of loop must be resolved in streaming programs and replaced with linearised NC block sequences.

The following control structures result in output of an error message and streaming mode is aborted:

- $FOR - $ENDFOR
- $DO - $ENDDO
- $REPEAT - $UNTIL
- $WHILE - $ENDWHILE

By contrast, control structures that only contain sequential program branches in the forward direction can also be used fully across several data packets.

- $SWITCH - $CASE - $DEFAULT – $ENDSWITCH
- $IF - $ELSE - $ELSEIF - $ENDIF

## Programing Example

Jump list in the forward direction

1st data packet 2nd data packet | %switchstream N010 G00 X0 Y0 Z0 N020 P1=10 N030 N040 $SWITCH P1

N050 $CASE 1

N060 X10

N070 $BREAK

N080 $CASE 5

N090 X50

N100 $BREAK

N110 $CASE 9

N120 X90

N130 $BREAK

N140 $CASE 10

N150 X100

N160 $ENDSWITCH

:

M30