For
For - a loop implementation which compiles 2 statements and 1 expression for work.
First of all (before loop) compiler compiles initializer statement, then on every iteration matching expression and calling iterator expression.
This style of for loop is similar as in C language.
Syntax
for (INITIALIZER; CONDITION; ITERATOR) { code };
Examples
tpl-lang
for (int8 a = 0; a < 5; a++) {
print(a);
}
0
1
2
3
4
tpl-lang
for (int8 a = 5; a > 0; a--) {
print(a);
}
5
4
3
2
1