Skip to content

forloop

Loop state inside for.

Available in: Inside for.

Property Type Description
forloop.index number 1-based index.
forloop.index0 number 0-based index.
forloop.rindex number Index from the end (1-based).
forloop.rindex0 number Index from the end (0-based).
forloop.first boolean First iteration.
forloop.last boolean Last iteration.
forloop.length number Number of iterations.
Liquid
{% for i in (1..3) %}{{ forloop.index }}{% if forloop.last %}!{% endif %}{% endfor %}
Output
123!

Since theme platform 1.0.

Was this page helpful?