twig for first index code example
Example 1: twig loop
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
Example 2: twig for loop key
{% for key, user in users %}
{{ key }}: {{ user.username|e }}
{% endfor %}
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
{% for key, user in users %}
{{ key }}: {{ user.username|e }}
{% endfor %}