Verification of running condition at the end of the loop
There are two kinds of loops available.
The syntax of the DO loop begins with:
$DO
and ends with:
$ENDDO <expr>
At the end of every loop pass the stated parameters are checked. The loop is broken off if the expression <expr> assumes the value range of FALSE (expr < 0.5).
The syntax of the REPEAT loop begins with:
$REPEAT
and ends with:
$UNTIL <expr>
At the end of every loop pass the stated parameters are checked. The loop is broken off if the expression <expr> assumes the value range of TRUE (expr > 0.5).
![]() | In contrast to $WHILE and $FOR loops the $DO and $REPEAT loops are always passed once at least. |
Programming example
N10 X0 Y0 Z0
N20 P2=10 P1=0
N30 $DO
N40 P1=P1+1
N50 XP1
N60 $ENDDO P1 <= P2 P1 is tested for FALSE at the end of the loop.
The loop is passed till P1 does not fulfill the
condition any longer.
N99 M30
N10 X0 Y0 Z0
N20 P2=10 P1=0
N30 $REPEAT
N40 P1=P1+1
N50 XP1
N60 $UNTIL P1 > P2 P1 is tested for TRUE at the end of the loop.
The loop is passed till P1 does fulfill the
condition.
N99 M30