Skip to content

increment

Creates and outputs a new number variable with initial value 0. On subsequent calls, it increases its value by one and outputs the new value.

Variables created using increment are independent from variables created using assign or capture.

Example:

liquid
{% increment my_counter %}
{% increment my_counter %}
{% increment my_counter %}

Output

html
1
2
3