FOR EACH statement repeatedly run the code in its body for every element in a given
MAP. At the start of each iteration an element of the collection is assigned to a variable matching its type.
If the collection is a
LIST, its elements will be iterated increasingly from index
0, while in the case of a
MAP all the elements will be iterated in no particular order.
FOR EACH <NUMBER-VAR> IN <NUMBER-LIST or NUMBER-MAP> DO#Code goes hereREPEATFOR EACH <TEXT-VAR> IN <TEXT-LIST or TEXT-MAP> DO#Code goes hereREPEAT
DATA:letter IS TEXTletters IS TEXT LISTPROCEDURE:PUSH "L" TO lettersPUSH "D" TO lettersPUSH "P" TO lettersPUSH "L" TO lettersFOR EACH letter IN letters DODISPLAY letterREPEAT# Will display "LDPL"
DATA:number IS NUMBERnumbers IS NUMBER MAPPROCEDURE:STORE 1 IN numbers:"One"STORE 2 IN numbers:"Two"STORE 3 IN numbers:"Three"FOR EACH number IN numbers DODISPLAY numberREPEAT# Will display "312" or any permutation