1``empty``
2=========
3
4.. versionadded:: 1.33
5
6    Support for the ``__toString()`` magic method has been added in Twig 1.33.
7
8``empty`` checks if a variable is an empty string, an empty array, an empty
9hash, exactly ``false``, or exactly ``null``.
10
11For objects that implement the ``Countable`` interface, ``empty`` will check the
12return value of the ``count()`` method.
13
14For objects that implement the ``__toString()`` magic method (and not ``Countable``),
15it will check if an empty string is returned.
16
17.. code-block:: jinja
18
19    {% if foo is empty %}
20        ...
21    {% endif %}
22
23