mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
18 lines
386 B
ReStructuredText
18 lines
386 B
ReStructuredText
``defined``
|
|
===========
|
|
|
|
``defined`` checks if a variable is defined in the current context. This is very
|
|
useful if you use the ``strict_variables`` option:
|
|
|
|
.. code-block:: jinja
|
|
|
|
{# defined works with variable names #}
|
|
{% if foo is defined %}
|
|
...
|
|
{% endif %}
|
|
|
|
{# and attributes on variables names #}
|
|
{% if foo.bar is defined %}
|
|
...
|
|
{% endif %}
|