foreach

All looping is done via foreach statements, which have two forms. One is:

foreach var in exp do
	block
end

Where exp has type t list, block is executed for each of exp's elements, binding var to each of them in order from first to last.

There is also a shortcut integer iteration form:

for var in fromExp .. toExp do
	block
end

fromExp and toExp must have type int. block is evaluated with var bound in sequence to each integer in the range defined by fromExp and toExp.



Adam Chlipala 2005-02-22