FOREACH INDEX

FOREACH _ _ _ _ _ _ _ _ _ _ _ _ command

foreachis a synonym for the for each variant of the for construct. It is designed to iterate down a list, and an error will occur if a list is not used. The use of for each is preferred to foreach.

syntax:

foreach<variable> in <list> <action> <expression >

where <action> ::= do | product | sum | collect | join

examples:


foreach x in {q,r,s} sum x**2; 

   2    2    2
  Q  + R  + S