break and continue - coldrockgames/doc-scriptor GitHub Wiki

These statements allow a more detailed control flow inside a loop.

They work identical to break and continue you know from gml or other languages.

Syntax

break
continue

break

  • Exits the loop immediately, bypassing the exit condition.
  • The script resumes execution at the first line after the loop.

Example:

for i = 1 to 10
    if i == 5 break
    // Loop ends when i equals 5
next

continue

  • Skips the remaining code in the current iteration.
  • Immediately jumps back to the beginning of the loop to reevaluate the exit condition.

Example:

for i = 1 to 10
    if i % 2 == 0 continue
    // This code runs only for odd numbers
next