4 ``defined`` checks if a variable is defined in the current context. This is very
5 useful if you use the ``strict_variables`` option:
9 {# defined works with variable names #}
10 {% if foo is defined %}
14 {# and attributes on variables names #}
15 {% if foo.bar is defined %}
19 {% if foo['bar'] is defined %}
23 When using the ``defined`` test on an expression that uses variables in some
24 method calls, be sure that they are all defined first:
28 {% if var is defined and foo.method(var) is defined %}