Quantcast
Channel: Mako: Ticket Query
Viewing all articles
Browse latest Browse all 38

#145: continue / break control statements?

$
0
0

Hi,

I was wondering how to use control/break within a loop. I didn't find anything in the docs, so I tried this:

% for i in range(10):

% if i == 3:

% continue

% endif ${i}

% endfor

That didn't work, so I ended up with this:

% for i in range(10):

<% if i == 3:

continue

%> ${i}

% endfor

I find the first version is more readable. Perhaps it would be nice to have 'continue' and 'break' statements to complement the flow control.

Alternatively, if there's another preferred method for issuing a continue or break, it would be great to have an example in the docs.

Thanks!


Viewing all articles
Browse latest Browse all 38

Trending Articles