DO...LOOP
 
Syntax


[DO] WHILE condition
    [statement block]
LOOP

DO
    [statement block]
[LOOP] UNTIL  condition

DO
    [statement block]
LOOP

Description


Repeats a block of statements until/while the condition is met.  The three above syntaxes show the different types.   The DO .. LOOP without a WHILE or UNTIL will loop forever, unless an EXIT statement is executed.

An EXIT is the proper way to leave a DO...LOOP, you can also use a GOTO or RETURN statement.

Example

'This will continue to print "hello" on the screen until the condition (a > 10) is met.

a = 1
DO
        PRINT "hello"
        a += 1
LOOP UNTIL a > 10

Differences from other BASICs


See also