Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2528

8-bit acorn software: other • Re: Mini-challenge: nested FOR with only one NEXT

$
0
0
It does work, but it uses the IF statement to control A and partly control B.

The two FOR loops here don't actually loop:

Code:

   10 FOR A=1 TO 4   20   FOR B=1 TO 5   30     PRINT A,B   40     B=B+1   50     IF B=6 THEN B=1:A=A+1   60     IF A<>5 THEN 30
One could set A and B to 1 and the code still works:

Code:

   10 A=1   20 B=1   30 PRINT A,B   40 B=B+1   50 IF B=6 THEN B=1:A=A+1   60 IF A<>5 THEN 30

Statistics: Posted by elkrepair — Thu Dec 19, 2024 7:24 pm



Viewing all articles
Browse latest Browse all 2528

Trending Articles