4.5.4 Use BScript Commands
Example of two REPEAT loops (one nested) using the default counter value for comparison:
REPEAT,
PX=0,OK
PY=0,OK
PZ=0,OK
PU=0,OK
REPEAT,
PX=0,OK
PZ=0,OK
UNTIL=3,
UNTIL=10,
The outside loop loops 10 times. The inside loop loops 3 times , but because the outside loop iterates 10 times it actually runs 30 times.
A math comparison using a reply value looks like this:
JX-,OK
REPEAT,
EP,
RSAVE1,
UNTILR1000:2000,
STOP,OK
Assuming the EP values start at 0000:0000:0000:0000 the program above loops until the first value returned from EP is between 1000 and 2000, then the loop ends and the STOP command is executed.
The UNTILR command is inclusive, meaning the value is valid if not only between the two range values, but also including the range values.
The RSAVE# command returns a reply of what the actual value it stores in memory from the previous reply value.