fixed if tag documentation

This commit is contained in:
Fabien Potencier
2010-12-18 13:44:51 +01:00
parent eedce6617e
commit e782d41963
+7 -3
View File
@@ -604,9 +604,8 @@ course this is not limited to commas:
If
~~
The ``if`` statement in Twig is comparable with the if statements of PHP. In the
simplest form you can use it to test if a variable is defined, not empty or
not false:
The ``if`` statement in Twig is comparable with the if statements of PHP. In
the simplest form you can use it to test if a variable is not empty:
.. code-block:: jinja
@@ -618,6 +617,11 @@ not false:
</ul>
{% endif %}
.. note::
If you want to test if the variable is defined, use ``if users is
defined`` instead.
For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use
more complex ``expressions`` there too: