Hymn Script
Home Learn Play Download Source Light

Loops



Loops are used to run the same code multiple times.

for i = 0, i < 12 {
  echo "i: ${i}"
}
for i = 12, i >= 0, i -= 1 {
  echo "i: ${i}"
}
set i = 0
while i < 12 {
  echo "Hi!"
  i += 2
}
for value in [2, 4, 6] {
  echo value
}

for id, value in [2, 4, 6] {
  echo "${id}: ${value}"
}
for value in { a: 2, b: 4, c: 6 } {
  echo value
}

for id, value in { a: 2, b: 4, c: 6 } {
  echo "${id}: ${value}"
}

Back to Conditionals Learn Exceptions