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

82 The REPEAT...UNTIL loop provides a much better way of dealing with this sort of problem. 3. If you omit the FOR statement an error will be generated. First a correct program: 10 FOR X=1 TO 5 20 PRINT "HELLO" 30 NEXT >RUN HELLO HELLO HELLO HELLO HELLO and then the program with line 10 deleted 20 PRINT "HELLO" 30 NEXT >RUN HELLO No FOR at line 30 4. Every FOR statement should have a matching NEXT statement. This can be easily checked by using LISTO 7 (list option 7). If the FOR...NEXT loops are correctly nested then the END in line 50 will line up with the FOR in line 5.

5 FOR H=1 TO 4 10 FOR X=1 TO 2 20 PRINT "HELLO" ,H,X 30 NEXT X 40 NEXT H 50 END >LISTO 7 >LIST 5 FOR H=1 TO 4 10 FOR X=1 TO 2 20 PRINT "HELLO", H,X 30 NEXT X 40 NEXT H 50 END >RUN HELLO 1 1 HELLO 1 2 HELLO 2 1