{{htmlmetatags>metatag-robots=()
metatag-title=(REPEAT...UNTIL | ugBASIC User Manual)
metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum)
metatag-description=(Manual page for REPEAT...UNTIL)
metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png)
metatag-og:title=(REPEAT...UNTIL | ugBASIC User Manual)
metatag-og:description=(Manual page for REPEAT...UNTIL)
}}
====== ugBASIC User Manual ======
===== REPEAT...UNTIL ✓ =====
===== SYNTAX =====
REPEAT
...
UNTIL expression
==== PURPOSE ====
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.
==== EXAMPLE ====
REPEAT
score = score + 1
UNTIL alive
See also the following example files:
* ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/control_loops_05.bas|control_loops_05.bas]]''
==== ABBREVIATION ====
RptUn
==== AVAILABLE ON ====
==== SEE ALSO ====
[[DO...LOOP]] [[WHILE...WEND]] [[FOR...NEXT]]
==== ANY PROBLEM? ====
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON REPEAT...UNTIL|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY =====
[[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]