Control Flow
loopCount
$loopCount
Returns the one-based number of the current iteration of the innermost loop ($for, $loop, $while, $jsonForEach).
Syntax
$loopCount
Parameters
None.
Return value
1,2,3… for the successive iterations ($loopIndex+ 1).- Outside a loop, the error “Loop index outside a loop.” is raised.
Examples
$for[3]
Step $loopCount of 3
$endFor
Notes
- For the zero-based index, use
$loopIndex,$loopIterationor$i. See $for.
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.