State Functions

Block state functions are a class of functions designed to access state information about the most recently-executed block. These functions can access information such as the current iteration number, the separator pattern, and the total number of repetitions the block will perform. Some can also perform certain actions depending on the current state of the block.

List of functions[link]

Function Description
[repnum] Current iteration number.
Sequence: [1 ... n]
[repelapsed] Number of finished iterations.
Sequence: [0 ... n - 1]
[reprem] Number of iterations remaining after current one.
Sequence: [n - 1 ... 0]
[repqueued] Number of iterations not completed yet.
Sequence: [n ... 1]
[repcount] Repetition count.
[depth] Number of currently active blocks.
[index] Zero-based index of current item.
[index1] One-based index of current item.
[even] Runs callback if current iteration is even.
[odd] Runs callback if current iteration is odd.
[nth] Runs callback if current iteration is a multiple of specified number.
[notnth] Runs callback if current iteration is not a multiple of specified number.
[ntho] Runs callback if current iteration with offset is a multiple of specified number.
[notntho] Runs callback if current iteration with offset is not a multiple of specified number.
[first] Runs callback if current iteration is the first.
[last] Runs callback if current iteration is the last.
[ends] Runs callback if current iteration is the first or last.
[middle] Runs callback if current iteration is neither the first nor last.
[sep] Runs separator pattern.

TODO: Needs examples

Comments