boucle for symfony with number 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 %}
Example 3: how to for loop twig
{% for letter in 'a'..'z' %}
* {{ letter }}
{% endfor %}
Example 4: index first twig
{{ loop.index }}
OR
{{ loop.index0 }}