Main Help → All Commands → Language Reference → Repeat
The Repeat
command can be used to set up loops in the commands. The format for repeat loops, which may be nested is:
Repeat "#x",start,end,<step> (commands in the loop) ... break ... Repeat "#y",start,end,<step> (commands in nested loop) ... continue ... Repeat (commands in nested continuous loop) ... breakAll ... EndRepeat EndRepeat EndRepeat
where
Repeat "#x",min,max,step
Repeat
with no variables will loop forever. It will cause an endless loop unless some condition within the loop forces a break.break
can be used in any loop. It will exit the current loop. If there are nested loops, control will enter the next higher loop.breakAll
can be used in any loop. It will exit all current loops and pass control to after the last EndRepeat
command.continue
command will increment the current loop variable and go back to the start of that loop. If the loop is done, it will exit.
Repeat "#x",1,5 Write #x #x+=10 EndRepeatwill write 1,2,3,4,5 on successive lines even though
#x
was changed in the loop. Each pass through the loop resets #x
to the next loop value.