---
title: "for"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/tag/for'
  md: 'https://developer.shopline.com/docs/sline/tag/for.md'
---

# for


    Renders a code block for each item in an array.

    Each `for` loop is associated with a [forloop](https://developer.shopline.com/docs/sline/object/forloop.md) object that contains information about the loop.



```sline
{{#for item in array}}
  expression
{{/for}}
```



    
      - `item`\: The item in the current iteration.
    
      - `array`\: The array to iterate over.
    
      - `expression`\: The code block to render in each iteration.
    







    
## Example

        
            

            

            

            
<SlineExample path={'/products/earring-ab001'} objects={ 
    [""] 
}>
```sline
{{#for tag in product.tags}}
  {{forloop.index}}: {{tag}}
{{/for}}
```
</SlineExample>
            
        
    
