summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChristoph Zwerschke <cito@online.de>2012-03-21 16:56:36 +0100
committerChristoph Zwerschke <cito@online.de>2012-03-21 16:56:36 +0100
commit4780c2ce31e9701cd60e227fee83a20cea8b7a8f (patch)
treefdfce5221a07695940f58276a0787c2394928165 /docs
parenta21f2edfc9536c918bae0ef654f9f3ffb1c2b508 (diff)
downloadjinja2-4780c2ce31e9701cd60e227fee83a20cea8b7a8f.tar.gz
Add a note about the else statement.
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/templates.rst b/docs/templates.rst
index a21e331..4a145c1 100644
--- a/docs/templates.rst
+++ b/docs/templates.rst
@@ -571,6 +571,10 @@ by using `else`::
{% endfor %}
</ul>
+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