Break : Continue


Syntax
Break [Level]
Description
Break allows to exit at any moment of the following loops: Repeat, For, ForEach and While. The optional 'level' parameter specifies the number of loops to exit from if there are several nested loops. Without any parameter, Break exits from the current loop.

Example: Simple loop

  For k=0 To 10
    If k=5
      Break  ; Will exit directly from the For/Next loop
    EndIf
    Debug k
  Next

Example: Nested loops

  For k=0 To 10
    Counter = 0
    Repeat
      If k=5
        Break 2 ; Will exit directly from the Repeat/Until and For/Next loops
      EndIf
      Counter+1
    Until Counter > 1
    Debug k
  Next

Syntax
Continue
Description
Continue allows to skip the end of the current iteration in the following loops: Repeat, For, ForEach, and While.

Example:

  For k=0 To 10
    If k=5
      Continue  ; Will skip the 'Debug 5' and go directly to the next iteration
    EndIf
    Debug k
  Next