foreach

Command foreach has following syntax:

for variable in array do code end

Loop is executed for each key in given array. In each step variable is assigned the next key from the array.

sum = 0
foreach i in myArray do 
  sum = sum + myArray[i]
end