You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #20531 introduced {{break}} and {{continue}} support, but they are currently limited to the innermost {{range}}.
I'd like to be able to {{break}} 2nd level {{range}} from inside an {{if ...}} block of an inner {{range}} block (to stop parsing a bigger list of objects when I've found what I was looking for).
The text was updated successfully, but these errors were encountered:
seankhliao
changed the title
text/template: add {{break 2}} and {{continue 2}} support
proposal: text/template: add {{break 2}} and {{continue 2}} support
Jan 13, 2024
The case arises rarely enough that the workaround seems fine. Templates do not have to support everything from other languages. Also, the numeric form of this (break 2) is famously error-prone. The right solution would involve adding statement labels, and that is a bridge too far.
Proposal Details
Issue #20531 introduced
{{break}}
and{{continue}}
support, but they are currently limited to the innermost{{range}}
.I'd like to be able to
{{break}}
2nd level{{range}}
from inside an{{if ...}}
block of an inner{{range}}
block (to stop parsing a bigger list of objects when I've found what I was looking for).The text was updated successfully, but these errors were encountered: