Loops

Create a for loop

Syntaxe

for (<variable-declaration> ; <condition> ; <variable-update>) {
    <block>
}

Variables declaration:

  • Classical variable declaration with syntax:

<identifier> : <type> = <value>;

Condition:

  • Classical condition to stop the for loop.

Variable update:

  • Classical assigment to variable in for scope.

Examples:

for (i: Int = 0; i < 10; i++) {
    <block>
}
for (; 1 == 1; ) {
    <block>
}

Last updated