intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 4.9 DESCRIPTION OF STATEMENTS STATEMENTS: DO -- WHILE [rel expr] MODE: RUN TYPE: CONTROL The DO -- WHILE [rel expr] instruction provides a means of "loop control" within an MCS BASIC-52 program. This operation of this statement is similar to the DO -- UNTIL [rel expr] except that all statements between the DO and the WHILE [rel expr] will be executed as long as the relational expression following the WHILE statement is true. DO -- WHILE and DO -- UNTIL statements can be nested. EXAMPLES: SIMPLE DO-WHILE NESTED DO-WHILE - DO-UNTIL >10 DO >10 DO : A=A+1 :

B=B+1 >20 A=A+1 >20 PRINT A,B,A*B >30 PRINT A >30 WHILE B 3 >40 WHILE A 40 B=0 >50 PRINT "DONE" >50 UNTIL A=3 >RUN >RUN 1 1 1 1 2 1 2 2 3 1 3 3 4 2 1 2 DONE 2 2 4 2 3 6 READY 3 1 3 > 3 2 6 3 3 9 READY > VARIATIONS: None - 37 -