You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loop statements allow reading a block of fields multiple times. Fields within a loop are converted an array where each element is the loop index. Nested loops create nested arrays. Within the loop, the field can be access directly referring to the current element; outside the loop, the field needs to be indexed. If a conditional is placed in a loop, the elements where the condition isn't taken will be set to null.
For for loops, both the init and step must either be missing or a (possibly compound) assignment.
type Example {
int32 a;
for (i = 0; i < a; i+=1) {
int64 b;
if (b > 0) {
int32 c;
}
}
assert b == [1, 0, 2]
assert c == [9, null, 10]
assert b[0] == 1;
set x = 9;
while (x > 0) {
int32 d;
set x -= 1;
}
do {
int32 e;
} while (e > 0);
}
The text was updated successfully, but these errors were encountered:
Loop statements allow reading a block of fields multiple times. Fields within a loop are converted an array where each element is the loop index. Nested loops create nested arrays. Within the loop, the field can be access directly referring to the current element; outside the loop, the field needs to be indexed. If a conditional is placed in a loop, the elements where the condition isn't taken will be set to
null
.For
for
loops, both the init and step must either be missing or a (possibly compound) assignment.The text was updated successfully, but these errors were encountered: