A statement which is the starting point of a REPEAT…UNTIL loop. A single REPEAT may have more than one UNTIL, but this is bad practice.
The purpose of a REPEAT…UNTIL loop is to make BBC BASIC (Z80) repeat a set number of instructions until some condition is satisfied.
You can force a premature end to the loop with the EXIT REPEAT statement. REPEAT…UNTIL loops may be nested.
REPEAT UNTIL GET=13 :REM wait for CR
X=0 REPEAT X=X+10 PRINT "What do you think of it so far?" UNTIL X>45
You must not exit a REPEAT…UNTIL loop with a GOTO. If you jump out of a loop with a GOTO (How could you!) you should jump back in. If you must jump out of the loop, you should use UNTIL TRUE to 'pop' the stack. For (a ghastly) example:
10 i=1 20 REPEAT: REM Print 1 to 100 unless 30 I=I+1: REM interrupted by the 40 PRINT i: REM space bar being pressed 50 x=INKEY(0): REM Get a key 60 IF x=32 THEN 110:REM exit if <SPACE> 70 UNTIL i=100 80 PRINT "****" 90 END 100 : 110 UNTIL TRUE: REM Pop the stack 120 PRINT "Forced exit":REM Carry on with program 130 FOR j=1000 TO 1005 140 PRINT j 150 NEXT 160 END
See Flow Control for more details on the working of the program stack.