mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-17 17:32:54 +00:00
15 lines
361 B
ReStructuredText
15 lines
361 B
ReStructuredText
``mapping``
|
|
===========
|
|
|
|
``mapping`` checks if a variable is a mapping:
|
|
|
|
.. code-block:: twig
|
|
|
|
{% set users = {alice: "Alice Dupond", bob: "Bob Smith"} %}
|
|
{# evaluates to true if the users variable is a mapping #}
|
|
{% if users is mapping %}
|
|
{% for key, user in users %}
|
|
{{ key }}: {{ user }};
|
|
{% endfor %}
|
|
{% endif %}
|