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