repeat foreach variableName in expression
statementList
lastlythenelse
statementList
end repeat
Expression yields a list.
repeat foreach x in (1,2,3,4,5,6,7,8,9,10) put x end repeat
repeat for each x in words of "1 2 3 4 5 6 7 8 9 10" put x end repeat
The repeat foreach structure causes all the statements inside to execute in a loop with as many iterations as there are elements in the list, with the specified variable containing the first element of the list during the first iteration, the second element of the list during the second iteration, and so on.
In OpenXION 1.3 and later, the statements under a lastly, then, or else keyword inside a repeat structure will be executed when the loop ends, unless the loop has ended because of an exit, pass, return, or throw.