6 Examples🔗ℹ

// A for loop that iterates between two bounds.
for x = 1 + 5 to 10 do
  printf("x is ~a\n" x)
 
// Similar to above but shows a block of expressions in the body
for x = 1 to 10 do {
 var y = x + 1;
 printf("x ~a y ~a\n", x, y)
}
 
// A for loop that iterates over a list of numbers
for x in [1, 2, 3] do {
 printf("x ~a\n", x);
}