Loops/Foreach: Difference between revisions

Line 297:
NEXT
PRINT</lang>
 
==={{header|Commodore BASIC}}===
Commodore BASIC too does not have a FOR-EACH construct. FOR loop is used to iterate through a string array by index. READ-DATA is used to fill up the string array
<lang qbasic>10 DIM A$(9) :REM DECLARE STRING ARRAY
20 REM *** FILL ARRAY WITH WORDS ***
30 FOR I = 0 TO 8
40 READ A$(I)
50 NEXT
60 REM *** PRINT ARRAY CONTENTS ***
70 FOR I = 0 TO 8
80 PRINT A$(I)" ";
90 NEXT
100 END
1000 DATA THE, QUICK, BROWN, FOX, JUMPS, OVER, THE, LAZY, DOG.</lang>
 
==={{header|Creative Basic}}===
<lang Creative Basic>DEF AnArray[11]:INT
DEF AnArray[11]:INT
 
AnArray=0,1,2,3,4,5,6,7,8,9,10
Line 308 ⟶ 321:
OPENCONSOLE
 
FOR X=0 TO 10
PRINT AnArray[X]
 
NEXT X
 
Anonymous user