From: Fabien Potencier Date: Fri, 1 Aug 2014 07:38:44 +0000 (+0200) Subject: added more docs for the if tag X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=21f0b829f9ad6be48ae778136682b5998d2149aa;p=web%2Fkonrad%2Ftwig.git added more docs for the if tag --- diff --git a/doc/tags/if.rst b/doc/tags/if.rst index d7a1451..6c9ac67 100644 --- a/doc/tags/if.rst +++ b/doc/tags/if.rst @@ -41,3 +41,20 @@ more complex ``expressions`` there too: {% else %} Kenny looks okay --- so far {% endif %} + +.. note:: + + The rules to determine if an expression is ``true`` or ``false`` are the + same as in PHP; here are the edge cases rules: + + ======= ==================== + Value Boolean evaluation + ======= ==================== + empty string false + numeric zero false + whitespace-only string true + empty array false + null false + non-empty array true + object true + ======= ====================