For Statement

For statements iterate over an array and repeatedly execute a block. Each iteration the for loop picks the next entry in the array.

The iterator expression must resolve to an array.

Structure

ForStmt = 'for' Identifier ( ':' Type )? 'in' Expression Block

Example

for x in range(0, 10) {
  print(x)
}

for y: Number in [1, 2, 3] {
  print(y)
}

References