For statement
Simple loop
for initializer[, end] {
// statements
}Counting numbers
for i = 1, 10 {
puts i
}Printing even numbers
for i = 0, 20 {
if i % 2 == 0 {
puts i
}
}Counting down
C-style loop
Basic
Without initializer
Without updater
For-each loop
Syntax
Examples
Infinite loop
Pure
With initializer
Last updated