The forloop object

The forloop object contains attributes of its parent for loop.

forloop.first

Returns true if it's the first iteration of the for loop. Returns false if it is not the first iteration.

forloop.index

Returns the current index of the for loop, starting at 1.

forloop.index0

Returns the current index of the for loop, starting at 0.

forloop.last

Returns true if it's the last iteration of the for loop. Returns false if it is not the last iteration.

forloop.length

Returns the number of iterations of the loop.

forloop.rindex

Returns forloop.index in reverse order.