twig check loop code example
Example 1: twig loop variables
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
Example 2: how to for loop twig
{% for letter in 'a'..'z' %}
* {{ letter }}
{% endfor %}
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
{% for letter in 'a'..'z' %}
* {{ letter }}
{% endfor %}