From 21f0b829f9ad6be48ae778136682b5998d2149aa Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 1 Aug 2014 09:38:44 +0200 Subject: [PATCH] added more docs for the if tag --- doc/tags/if.rst | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) 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 + ======= ==================== -- 1.7.2.5