mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 20:06:31 +00:00
Adding example with `not for if`
I could not find an example with ``not``, so I added it here.
This commit is contained in:
@@ -29,6 +29,14 @@ You can also test if an array is not empty:
|
||||
If you want to test if the variable is defined, use ``if users is
|
||||
defined`` instead.
|
||||
|
||||
You can also use ``not`` to check for values that evaluate to ``false``:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{% if not user.subscribed %}
|
||||
<p>You are not subscribed to our mailing list.</p>
|
||||
{% endif %}
|
||||
|
||||
For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use
|
||||
more complex ``expressions`` there too:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user