increment Tag
Creates a new number variable, increases its value by 1 every time it is called, and
outputs it.
Description
Creates a new number variable, increases its value by 1 every time it is called,
and outputs it. The initial value is 0.
Consider this example:
{% increment my_num %}
{% increment my_num %}
{% increment my_num %}
Output
0 1 2
Note that increment works independently of variables created by
assign and
capture, even if they share the
same name.
{% assign var = 10 %}
{% increment var %}
{% increment var %}
{% increment var %}
Output
0 1 2 10
Parameters
None.