Current Page: NeXtMidas Training Macros - Part 1 (Basics) Loops and Control Structures Loops BREAK and CONTINUE
- - | The `BREAK` Command: The `BREAK` command is used to exit the nearest enclosing `WHILE`, `DO`, or `FOREACH` loop. It functions similarly to the Java `break` Statement. For example, the following loop will exit once it reaches 4:
        do count 1 7 1
          if count EQ 4 then BREAK
          say "The count is at ^count"
        enddo
- - See the `BREAK` explain file for more details. The `CONTINUE` Command: The `CONTINUE` command is used to quit the current iteration and starts the next one of the nearest enclosing `WHILE`, `DO`, or `FOREACH` loop. It functions similarly to the Java `continue` Statement. For example, the following loop will skip the `SAY` when `count` is `4`:
        do count 1 7 1
          if count EQ 4 then CONTINUE
          say "The count is at ^count"
        enddo
See the `CONTINUE` explain file for more details.