]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/twig/twig/doc/tests/iterable.rst
gitignore vendor
[github/wallabag/wallabag.git] / vendor / twig / twig / doc / tests / iterable.rst
CommitLineData
4f5b44bd
NL
1``iterable``
2============
3
4.. versionadded:: 1.7
5 The iterable test was added in Twig 1.7.
6
7``iterable`` checks if a variable is an array or a traversable object:
8
9.. code-block:: jinja
10
11 {# evaluates to true if the foo variable is iterable #}
12 {% if users is iterable %}
13 {% for user in users %}
14 Hello {{ user }}!
15 {% endfor %}
16 {% else %}
17 {# users is probably a string #}
18 Hello {{ users }}!
19 {% endif %}