REPEAT ... UNTIL expression
The 'REPEAT…UNTIL
command will repeatedly execute a block of code until a certain
condition is met. In essence, it creates a loop that continues to repeat until a specific
exit condition is met.
When you don't know exactly how many times you want to repeat a block of code, but you want to continue until a certain condition is met, this is the best command to use. For example, to repeatedly prompt the user for input until they enter it correctly. Another usage is to perform calculations that require multiple iterations, such as finding the square root of a number using the Newton-Raphson method.
Make sure the condition inside UNTIL
can become true at some point, otherwise your
program may end up in an infinite loop. If you need to execute a loop a large number
of times, consider optimizing your code to improve performance.
RptUn
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!