40 votesMatthew Ricks supported this idea ·Matthew Ricks commented
I'd prefer it if it were break n instead of break(n) because that (to me) maintains the break keyword usage.
There's nothing wrong with extra variables, but sometimes they're flags that just add clutter. I think the break n could easily be more readable. Potentially abused? Yes, but we can deal with that.
I understand the switch/loop confusion, but I don't think it's that big a deal. It's pretty obvious if the break is at the level of a switch, and usually obvious if it's breaking a loop. I think standardizing that break n only breaks loops solves the issue.
Could definitely refactor, but sometimes it doesn't make sense to break it out into a separate method.
And, unless I miss my mark, goto is more likely to make code fragile than this feature.