Skip to content

Repetition with Loops

while loop

Repeats a block as long as the condition is true.

red
while <condition> {
    <statements>
}
red
fn main() {
    let i = 0;
    while i < 5 {
        i += 1;
    }
    print(i); // 5
    return 0;
}

for loop

Not yet implemented.

Released under the MIT License.