16 Break
A valueless break leaves the current statement loop immediately.
norm
main() {
List<String> tasks = ["read", "stop", "change"]
for task : tasks {
if task == "stop" {
break
}
printLine(task)
}
printLine("finished")
}Expected output:
text
read
finishedThe item stop is never printed, and neither is the following item: control resumes after the loop. The final line proves execution continues outside it.
Try it: Move stop to the last position and compare the output.
Precise rules: Reference.