Is it possible to use continue/break in a %control structure loop.
For example:
% for x in range(1):
% continue
% endfor
Thanks,
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