Loop, Break & Continue
loop repeats its block with no condition of its own - it runs until a break ends it. That makes it the shape for "repeat until done", where the exit condition emerges mid-iteration rather than up front. break and continue are not tied to loop: they steer while and for loops the same way.
loop runs until break
The block executes over and over; break exits immediately, and whatever the variables hold at that moment is what you keep. Here the exit condition depends on the value being computed - exactly the case a condition-first loop states awkwardly:
continue skips to the next iteration
continue abandons the rest of the current iteration and jumps straight back to the top. Statements after it - including writes - simply do not run for that pass. Note the ; after each if ... { ... } block before the next statement:
Carry a result out of the loop
Variables declared before the loop survive it; variables declared with let inside the block are scoped to one iteration. Accumulate into outer variables, use them after break:
break and continue work in every loop
A while loop can bail out before its condition turns false:
And continue inside a for loop acts as a per-iteration filter:
There is no infinite loop
A loop with no reachable break does not hang the engine. Iteration is capped at 10,000; exceeding the cap fails the request with RUNTIME_006, and the failed request rolls back like any other error:
