Loops/Foreach: Difference between revisions

Line 656:
=={{header|IWBASIC}}==
<lang IWBASIC>
== Linked List ==
 
DEF AList:POINTER
 
DEF X:INT
 
AList=ListCreate()
 
'add items to the list
FOR X=0 TO 10
POINTER Temp=ListAdd(AList,NEW(INT,1))
#<INT>temp=X
NEXT X
 
'***iterate the list with the "for each" loop***
FOR Temp=EACH AList AS INT
 
PRINT #Temp
NEXT
 
== An Array ==
 
'iterate an array
DEF AnArray[11]:INT