Loops/Nested: Difference between revisions

Content added Content deleted
(Added Wren)
(Added Commodore BASIC)
Line 501: Line 501:
NEXT col
NEXT col
NEXT row</lang>
NEXT row</lang>

==={{header|Commodore BASIC}}===
We should END gracefully. (The Sinclair example below will produce an error on any Commodore machine.)

Also... What if no 20 is ever found?

<lang CommodoreBASICv2>
10 dim a$(20,20):print "initializing...":print
20 for r=1 to 20:for c=1 to 20
30 a$(r,c)=chr$(int(rnd(1)*20)+1)
40 next c,r
50 rem now search array
60 for r=1 to 20:for c=1 to 20
70 e=asc(a$(r,c))
80 print "(";r;","c;") =";e
90 if e=20 then print "found 20. stopping search.":end
100 next c,r
110 print "search complete. no 20 found.":end
</lang>


==={{header|Sinclair ZX81 BASIC}}===
==={{header|Sinclair ZX81 BASIC}}===