Click here to return to the KiXtart HelpDesk main page...

KiXtart 2001 Manual

For Each

Action: Repeats a group of statements for each element in an array or collection.
Syntax: FOR EACH $element IN group

FOR EACH loops can be nested as many times as memory allows.



Variable used to iterate through the elements of the collection or array.


Name of an object collection or array.

Remarks: The For Each block is entered if there is at least one element in group. Once the loop has been entered, all the statements in the loop are executed for the first element in group. As long as there are more elements in group, the statements in the loop continue to execute for each element. When there are no more elements in group, the loop is exited and execution continues with the statement following the Next statement.
See Also: Do Until, For Next, While Loop
Dim $MyArray[10]
For Each $Element In $MyArray
  ? $Element

$Root = GetObject( "LDAP://localhost" )
For Each $Obj in $Root
  ? $