Iteration
Iteration
Iteration tags run blocks of code repeatedly.
for
Repeatedly executes a block of code. For a full list of attributes available within a for loop, see forloop (object).
Input
{% for product in collection.products %} {{ product.title }} {% endfor %}
Output
hat shirt pants
break
Causes the loop to stop iterating when it encounters the break tag.
Input
{% for i in (1..5) %} {% if i == 4 %} {% break %} {% else %} {{ i }} {% endif %} {% endfor %}
Output
1 2 3
continue
Causes the loop to skip the current iteration when it enco