Skip to content

decrement

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

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

Example:

liquid
{% decrement variable %}
{% decrement variable %}
{% decrement variable %}

Output

html
-1
-2
-3