Verification of running condition at loop end ($DO), ($REPEAT)

There are two kinds of loops available.

Syntax:

The syntax of the DO loop starts with:

$DO

and always ends with

$ENDDO <expr>

The stated parameters are checked at the end of every loop pass. The loop is aborted if the expression <expr> assumes the value range FALSE (expr < 0.5).

Syntax:

The syntax of the REPEAT loop starts with:

$REPEAT

and always ends with

$UNTIL <expr>

The stated parameters are checked at the end of every loop pass. The loop is aborted if the <expr> assumes the value range TRUE (expr < 0.5).

Notice

notice

As opposed to the $WHILE and $FOR loops, the $DO and $REPEAT loops are always passed at least once.

Programing Example

prg_example

Verification of running condition at loop end

N10 X0 Y0 Z0

N20 P2=10 P1=0

N30 $DO

N40 P1=P1+1

N50 XP1

N60 $ENDDO P1 <= P2       P1 is checked for TRUE at loop end.

                          The loop is passed until P1 no longer

                          fulfils the condition.

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 checked for TRUE at loop end.

                          The loop is passed until P1 no longer

                          fulfils the condition.

N99 M30