Skip to content
Control Flow continue

$continue

$continue skips the rest of the current iteration of the innermost running loop ($for, $loop, $while or $jsonForEach) and goes on with the next one.

Syntax

$continue

$continue takes no argument ($continue[x] is refused).

Behavior

  • Only the innermost loop is affected.
  • Outside of a loop it raises the error “Continue outside a loop.”.
  • In a C-style $for[i=0;i<5;i++] loop the update clause still runs, so the loop moves forward. In a $while loop the condition is evaluated again.
  • To leave the loop altogether, use $break.

Example

$for[5]
  $if[$i==2]
    $continue
  $endif
  $i
$endFor

This prints 0134.

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.