In short, continue and break can be easily abused. When used in moderation and with careful consideration, these kind of jump statements are fine. However, be careful not to abuse them. The venerable GOTO statement of older programming languages got a bad reputation because it was abused so much.
Is venerable the right word for goto? Even Kernighan and Ritchie don't use it in their classic book. Remember that it is always possible to write your code without using goto or any surrogates for it, including break and continue. Dijkstra wrote the Goto considered harmful article (which Junilu mentioned in the link he posted) as a letter to the Communications of the ACM; there are many places which have PDF copies of it, this being one I found on Google Scholar.
Strict avoidance of goto and its surrogates is called structured programming (probably) after the title of a book by Dahl, Dijkstra and Hoare in 1972. The concepts of structured programming are older than that; it was originally thought that avoiding spaghetti code would allow faster and more reliable software creation. Just goes to show how mistaken overoptimistic one can be.
I used "venerable" to emphasize that it gets a bad rap because of misuse. Undisciplined use of GOTO is really what the issue was. If you break down flow control statements, they are really mostly conditional jumps. A GOTO is a jump. They say that Anders Hejlsberg, the architect of Turbo Pascal, Delphi, and C# could write object-oriented assembly language programs. I doubt you can do that without a lot of disciplined use of JMP instructions.
EW Dijkstra wrote:I became convinced that the go to statement should be abolished from all "higher-level" programming languages (i.e. everything except, perhaps, plain machine code)
Even Dijkstra seems to concede that you really can't get rid of GOTO at some level of code. If you really think about it, we use GOTO all the the time, except it's hidden in more structured language constructs to protect us from a lack of discipline.
More from the essay:
The unbridled use of go to has an immediate consequence... The go to as it stands is just too primitive; it is too much an invitation to make a mess of one's program. One can regard and appreciate the clauses considered as bridling its use.
I hope nobody reading this takes it as an endorsement of GOTO in higher level languages on my part. I agree, they are dangerous. I'm just trying to point out that whoever says they don't like GOTO really is saying they don't like undisciplined use of jump instructions because no matter how it's dressed up, whether as an if-statement or a break or a continue or while-statement or even a return statement, these are all jumps, which really boils down to a GOTO at the machine level.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop