`prev Menu next`

Introduction to BASIC DO～LOOP
DO～LOOP
The statements written between a DO line and a LOOP line shall be executed repeatedly.
If an EXIT-DO statement is executed, the repetition finishes and the control branches to the line following the LOOP line.
Example. A program which displays "2+4=?" and ask an input until 6 is entered.

    10 DO
    20   PRINT "2+4=?"
    30   INPUT n
    40   IF n=2+4 THEN EXIT DO
    50 LOOP
    60 END

Refer to DO～LOOP
IF line
Line 40 of the above program is a IF Line.
On a IF line, one statement can be written on the right hand side of THEN.
A IF line has no corresponding END-IF line .
Refer to IF statement