Is using the break statement bad practice?
I've been told by professors and peers at my university that using the break statement is bad practice, but through my coursework开发者_Go百科 haven't come up with a great reason why. Those who claim that it is bad say that it's a "get out of jail free card" and that you can always avoid using it.
My guesses for why its considered bad would be that you could possibly skip some cleanup code after the break, or similarly exit some control structure in an inconsistent state.
Is there any reason why using break is(n't) bad practice?
精彩评论