twig for as code example
Example 1: how to for loop twig
{% for i in 0..10 %}
* {{ i }}
{% endfor %}
Example 2: twig for loop key
{% for key, user in users %}
<li>{{ key }}: {{ user.username|e }}</li>
{% endfor %}
{% for i in 0..10 %}
* {{ i }}
{% endfor %}
{% for key, user in users %}
<li>{{ key }}: {{ user.username|e }}</li>
{% endfor %}