Description
The Repeat Until block iterates over a list of blocks until a condition becomes true ending the iteration. The condition is checked at the end of the loop so the block list is always performed at least one time. The Repeat Until block contains an internal yield.
It is possible to have a Repeat Until block with an empty body however the Wait Until block would be a better choice.
Escapes
The Repeat Until block does not produce any escapes.
Examples
This list of blocks staples the side of a part by placing a staple in the current position and advancing. It places a staple every Staple Pitch distance until the desired length is achieved. It would be possible to do the math to identify the number of staples required and use the loop block
but stapling until the distance is achieved is simpler.
This block list begins moving a linear slide over a distance making measurements and capturing the maximum measurement found until the move is finished:
Note that a variable named "Measurement" is used to buffer the reading from the pressure sensor. IO is performed on demand. If there are two references to the Pressure Sensor Voltage within a block list it is possible to get two slightly different answers. Consider what might happen if the inner
conditional looked like this
The first reading might be slightly high exceeding the maximum level. Inside the conditional the second reading might be slightly low and be less than the maximum level but the assignment is occurring at that point so the maximum level could be overwritten with a lesser value. These effects are
more pronounced when there is more time between the two references. Usually readings need to be consistent from the decision that is based on them to the use of the information. To insure the information is stable and does not change store the information in a variable first and then reference the variable.
Related Topics
Loop
While
Yield