The flow or execution of a loop can be controlled by use of break and continue expressions.
break exits the current loop. In case the loop is nested inside another loop, the parent loop is unaffected.
for (i in 0...10) {
for (j in 0...10) {
if (j == 5) break;
trace(i, j);
}
}
Try the example on try.haxe.org.
continue skips the current iteration of the loop at the point of the expression. In case the loop is nested inside another loop, the parent loop is unaffected.
for (i in 0...10) {
for (j in 0...10) {
if (j == 5) continue;
trace(i, j);
}
}
Try the example on try.haxe.org.