For Each-Next
From REALbasicWiki
For Each - Next is a looping control structure that allows you to iterate over the elements of a one-dimensional array.
[edit] Syntax
For Each variableName [as type] in arrayReference Next [variableName]
[edit] Discussion
For Each-Next is an alternative to a For-Next loop for iterating through an array. Its main advantage is that it prevents the possibility of -- and the need to check for -- OutOfBoundsExceptions. One disadvantage is that the documentation explicitly disclaims any guarantee of iteration order.
The iteration variable variableName can be a local variable. It can be declared above the block, or declared in the block with the optional as type clause. It can also be a dot-free expression
This counter must be a variable, and must satisfy the same conditions as a variable passed by reference.
The type of variableName must match the type of arrayReference at compile-time. In addition to the obvious exact match, there are some other matches acceptable to the compiler.
