Is it possible to use continue/break in a %control structure loop.
For example:
% for x in range(1):
% continue
% endfor
Thanks,
Mako is a template library written in Python. Mako is an embedded Python (i.e. Python Server Page) language, which refines the familiar ideas of componentized layout and inheritance. The Mako template is used by Reddit. It is the default template language included with the Pylons and Pyramid web frameworks.
Comments. Comments come in two varieties. The single line comment uses ## as the first non-space characters on a line: ## this is a comment. ...text ...
Yes. You use <% continue %>
and <% break %>
.
Example:
from mako.template import Template
t = Template(
"""
% for i in xrange(5):
% if i == 3:
<% break %>
% endif
${i}
% endfor
% for i in xrange(5):
% if i == 3:
<% continue %>
% endif
${i}
% endfor
""")
print t.render()
Output:
0
1
2
0
1
2
4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With