Skip to content
Myr

Add a note about the else statement.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christoph Zwerschke · committed by Christoph Zwerschke · parent a21f2ed · Browse files · 1 file+4 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−0 removed

  • other:+4 added−0 removed

1 file+4 added−0 removed

modified:docs/templates.rst+4 added
569 unmodified lines
570 <li><em>no users found</em></li>571 {% endfor %}572 </ul>573574Note that in Python `else` blocks are executed whenever the corresponding575loop did not `break`. Since in Jinja loops cannot `break` anyway,576a slightly different behavior of the `else` keyword was chosen.577578It is also possible to use loops recursively. This is useful if you are579dealing with recursive data such as sitemaps. To use loops recursively you580basically have to add the `recursive` modifier to the loop definition and581call the `loop` variable with the new iterable where you want to recurse.
803 unmodified lines