# Iteration Tags These tags are used to loop over collections and arrays in Liquid templates. They allow you to repeat content for each item in a collection, making it easy to display lists and tables. Use these tags to iterate over products, categories, or any array of data. ## break Break iteration of the current loop **Input** ```liquid {% for i in (1..5) %} {% if i == 4 %} {% break %} {% endif %} {{ i }} {% endfor %} ``` **Output** ``` 1 2 3 4 ``` --- ## continue Skips the current iteration of the current loop **Input** ```liquid {% for i in (1..5) %} {% if i == 4 %} {% continue %} {% endif %} {{ i }} {% endfor %} ``` **Output** ``` 1 2 3 5 ``` --- ## cycle Loops through a group of strings and prints them in the order that they were passed as arguments. Each time cycle is called, the next string argument is printed. `cycle` must be used within a `for` loop block. **Parameters** `cycle` accepts a “cycle group” parameter in cases where you need multiple cycle blocks in one template. If no name is supplied for the cycle group, then it is assumed that multiple calls with the same parameters are one group. **Input** ```liquid {% cycle "one", "two", "three" %} {% cycle "one", "two", "three" %} {% cycle "first": "one", "two", "three" %} {% cycle "one", "two", "three" %} ``` **Output** ``` one two one three ``` --- ## for Repeatedly executes a block of code. **Parameters** | Name | Description | | ------ | ------------------------------------------------------ | | limit | Limits the loop to the specified number of iterations. | | offset | Begins the loop at the specified index. | **Input** ```liquid {% for product in category.products %} {{ product.title }} {% endfor %} ``` **Output** ``` hat shirt pants ``` `for` tag can also have an `else` condition **Input** ```liquid {% for product in category.products %} {{ product.title }} {% else %} This category doesn't have any products {% endfor %} ``` **Output** ``` This category doesn't have any products ``` You can also use `break` (stop iteration) or `continue` (skip rest of the current iteration) tags inside for block. --- ## tablerow Generates an HTML table. Must be wrapped in opening `
| Product name |
| Second product name |