Executable Block Statements - REPEAT, UNTIL (Loops)

When it is desirable to execute certain statements repeatedly until a specific condition is met, the REPEAT, UNTIL may be used. One of the logical arguments described in the previous section for use with the IF_SET statement, or a variable name may be used to set the condition under which the executable statements will be repeated. In the case of the variable name, the statements will be executed if the indicator of the variable is "on".

The statements to be executed repeatedly are listed after the REPEAT statement. The condition follows the UNTIL statement.

Example:

CIRCULAR MOTION:

. . .

. . .

IND = 0 ;

XNEW = X_CURPOS ;

YNEW = Y_CURPOS ;

REPEAT

IND = IND + 1 ;

XNEW = XNEW + XDEL ;

YNEW = YNEW + YDEL ;

OUTPUT $ LIN_MOV ;

IF_SET (XNEW) OUTPUT "X" XNEW ; END_IF ;

IF_SET (YNEW) OUTPUT "Y" YNEW ; END_IF ;

UNTIL (IND_EQ_NSEG) ;

In the example, NSEG represents the number of linear segments which represent the arc (i.e., the number of times XDEL and YDEL increments and translation are to be applied to XNEW and YNEW). The linear movement will be repeated until the counter IND is equal to NSEG.

Some functionality may be dependent on the product package. Contact your Reseller if you require a license.