Misc
endLoop
$endLoop
Marks the end of a $loop block.
Syntax
$endLoop
Parameters
This function has no parameters.
Description
$endLoop is the closing tag for a loop block opened with $loop[iterations]. Everything between $loop[...] and $endLoop is the loop body and will be repeated the specified number of times.
Every $loop must be paired with exactly one $endLoop. Forgetting to close a loop results in a parse error.
Examples
Basic Loop
$loop[3]
This message repeats 3 times.
$endLoop
Loop with Inner Logic
$var[total;0]
$loop[5]
$var[total;$sum[$var[total];10]]
$endLoop
Total: $var[total]
Output: Total: 50
Nested Loops
$loop[2]
Row:
$loop[3]
- Item
$endLoop
$endLoop
Output:
Row:
- Item
- Item
- Item
Row:
- Item
- Item
- Item
Notes
$endLooptakes no parameters — adding any is an error (“$endloop does not accept arguments.”).- A
$endLoopwith no open$loopis an error (“Unexpected $endLoop.”), as is a$loopthat is never closed (“Missing $endloop.”). - This closes only a
$loopblock, not the$forloop (which uses$endFor): mixing them is an error. See $loop. - The parser treats
$loop/$endLoopas structural tokens, similar to$if/$endif. - When nesting loops, ensure each
$loophas its corresponding$endLoopin the correct order (LIFO: Last In, First Out).
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.