twig loop variables code example
Example 1: twig loop variables
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
Example 2: how to for loop twig
{% for i in 0..10 %}
* {{ i }}
{% endfor %}
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
{% for i in 0..10 %}
* {{ i }}
{% endfor %}