Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF

81 30 NEXT 40 PRINT "OUT OF LOOP" 50 PRINT Z > >RUN 0 5 10 OUT OF LOOP 15 Note that it is not necessary to say NEXT Z in line 30: it is optional, though it could be argued that it is clearer to put the Z in. 2. You should never jump out of a FOR...NEXT loop. It is generally accepted that this is poor style.

If you do this your programs will become extremely difficult to follow – there are always better alternatives usually involving the use of a procedure, or setting the control variable to a value greater than the terminating value for example 10 FOR X=0 TO 1000 15 PRINT 20 PRINT "TYPE IN A SMALL NUMBER" 30 PRINT "OR ENTER -1 TO STOP THE PROGRAM" 40 INPUT J 50 IF J=-1 THEN X= 2000 60 PRINT "12 TIMES ";J;" IS "; 12*J 70 NEXT X > >RUN TYPE IN A SMALL NUMBER OR ENTER -1 TO STOP THE PROGRAM ?32 12 TIMES 32 IS 384 TYPE IN A SMALL NUMBER OR ENTER -1 TO STOP THE PROGRAM ?456 12 TIMES 456 IS 5472 TYPE IN A SMALL NUMBER OR ENTER -1 TO STOP THE PROGRAM ?-1 12 TIMES -1 IS -12