Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
nlewycky
· 4y ago · 0 comments
break and continue with an integer argument, how many times to break. "break" breaks out of nearest loop, "break 2" breaks out of two. "continue 2" breaks out of one loop and then performs "continue" on the loop outside that.
Comments
[–]
hvdijk
4y ago
Labels would be more readable for that IMO:
outer: for (...) for (...) if (...) break outer;
[–]
compiler-devel
4y ago
This is a neat idea but I'm afraid it's fraught in that the resulting code could be as hard to maintain as the same written with goto.