blob: 4ebfe9d8a50b266f85ca05f594d2f69842c35dd3 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``iterable``
2============
3
4``iterable`` checks if a variable is an array or a traversable object:
5
6.. code-block:: twig
7
8 {# evaluates to true if the foo variable is iterable #}
9 {% if users is iterable %}
10 {% for user in users %}
11 Hello {{ user }}!
12 {% endfor %}
13 {% else %}
14 {# users is probably a string #}
15 Hello {{ users }}!
16 {% endif %}