From 4780c2ce31e9701cd60e227fee83a20cea8b7a8f Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 21 Mar 2012 16:56:36 +0100 Subject: [PATCH] Add a note about the else statement. --- docs/templates.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/templates.rst b/docs/templates.rst index a21e3310..4a145c13 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -571,6 +571,10 @@ by using `else`:: {% endfor %} +Note that in Python `else` blocks are executed whenever the corresponding +loop did not `break`. Since in Jinja loops cannot `break` anyway, +a slightly different behavior of the `else` keyword was chosen. + It is also possible to use loops recursively. This is useful if you are dealing with recursive data such as sitemaps. To use loops recursively you basically have to add the `recursive` modifier to the loop definition and -- 2.47.2