- Up - | Next >> |
Oz has a looping construct introduced by the keyword for
. The simplest form is to iterate over the elements of a list:
for X in [a b c] do {Inspect X} end
One can think of X
as a mutable variable that succesively takes of values of the list [a b c]
. You can also use special syntax to write something loops over integers:
for I in 2..25 do {Inspect I} end
This has the same effect as if I
ranged over the integer list [2 ... 25]
except that this list is never constructed explicitely.
- Up - | Next >> |