Skip to main content

For Loop

C-style counted loop with init, condition, and increment.


Syntax

for (init; condition; increment) {
// body
}

Example

for (i is 0; i < 10; i++) {
Print(i);
}

Counting Down

for (i is 10; i > 0; i--) {
Print(i);
}

Nested Loops

for (i is 0; i < 3; i++) {
for (j is 0; j < 3; j++) {
Print(i * 3 + j);
}
}

Next Steps