ForEachLoop through each element of an array/list ForEach will loop through a list or array, setting the key/value parameters for each iteration. You may not alter the list/array length/indicees during the loop, although you may change list contents.
"Key" and "Value" variables are constants within the scope of the loop, and can not be changed.
Sample SourceCreateArray MyArray
MyArray["first"] := "One"
MyArray["second"] := "Two"
MyArray["third"] := "Three"
ForEach Value In MyArray
Say "\nItem Value: "
Say Value
Loop
|
Sample SourceCreateArray MyArray
MyArray["first"] := "One"
MyArray["second"] := "Two"
MyArray["third"] := "Three"
ForEach Key As Value In MyArray
Say "\nItem '" + Key + " 'Value: "
Say Value
Loop
|
Sample SourceCreateList MyList
InsertBefore 1 To MyList
InsertAfter "Item Two" To MyList
ForEach Value In MyList
Say "\nItem Value: "
Say Value
Loop
|
Related Function(s): CreateArray; CreateList; CurrentItem; For; Minimum version: 4.8
|