for each ... next
Iterate through array, sequentially assigning the key from each array index to variable.
Syntax:
for each variable In array
commands
[exit for]
[continue]
next
The commands between for each statement and next statement are executed each iteration through the loop. In optional way you can use the end for statement in place of next statement.
Example:
' Create a dynamic arrays
dim number[]
' Fill it with values
number[1] = "one"
number[2] = "two"
number[3] = "three"
number["four"] = 4
number["five"] = 5
number["six"] = 6
' Display the keys and values
for each k in number
print k, number[k]
end for ------------------- you can use indifferently next or end for
See also exit for and continue commands.