News flash: I'm going to Australia in February, so this Web site may be switched off at any time.
There are two important properties of Icon expressions:
In general, Icon loops take the form
``every e1 do e2
''
where e1 and e2 can be any expression.
If e1 produces no results, e2 is never
evaluated. If it produces 19 results, e2 is evaluated
19 times, and so on.
Let's take another look at the loop in the simple arithmetic program:
every n := 1 to 5 do # For n equal to 1, 2, 3, 4, 5 ... sum := sum + n; # ...add n to the sumIn this case, the expression ``
n:=1 to 5
'' produces
five results, so the loop is executed five times. The expression
``1 to 5
'' produces the values from 1 to 5 in sequence.
john@nmt.edu