[Solved] Is the break statement in Java or programming in general indispensable?


I don’t recommend you to use break statement if it’s not strict necesary it’s use.

It isn’t a good practise in programming (look at this: Is it a bad practice to use break in a for loop?) and I recommend you to use another alternatives, instead of break that could make the same work.

For example, you can wrap your code into a loop that finish with the same condition in which you wanted to put the break statement.

I always try not to use this break statement but, for example when I have to use a switch I always use it. It depends of the mind of each person, some persons think that break statement it’s necesary and another people, like me, try to avoid it.

I expect it helps you to see the concept more clearly.

2

solved Is the break statement in Java or programming in general indispensable?