title: “CONTINUE” author: “laplante@plcb.ca” date: 2023-01-01 version: “1.0.0”
The continue
statement is used to skip the remainder of the current iteration of a for
loop and jump directly to the next iteration.
This allows the loop to proceed without executing any further code in the current iteration.
When used with a label, continue
behaves like a controlled goto
, resuming execution at the beginning of the loop identified by the label.
⚠️ Restrictions:
This ensures that loop control remains structured and predictable.
T_CONTINUE T_SEMICOLON
T_CONTINUE T_ID T_SEMICOLON
Example with nested loops using continue
:
res={{
i := 1;
for i < 5 {
"i="; i;
j := 1;
for j < 5 {
j++;
if j == i {
continue;
}
"j="; j;
}
i++;
}
}}.
res=i=1j=2j=3j=4j=5i=2j=3j=4j=5i=3j=2j=4j=5i=4j=2j=3j=5.