spaghetti code...

I understand that it is taboo to use the GOTO in modern programming as it can make a program hard to read. Well, with that said I just learned about the continue statement which apparently will jump you back to the beginning of whatever loop your in. Is it also taboo to use the continue statement to jump back to the top of a loop? I just want to be sure I do not start forming bad habits.

As always, thanks a lot for your guidance!
No, continue is fine AFAIK.
When you program your aim is to make code readable for other people - besides optimizing etc. Readable code is more reliable and easier to modify. Using goto extensively makes the code more difficult to follow so it's not 'goto' per se that is evil but the resulting code. In C++ there is no real need to use goto but in C it sometimes it has its uses to make the code clearer.

So my advice is think how other people read your code and code from that perspective.


talking about goto, http://www.cplusplus.com/doc/tutorial/control.html#goto
says
You should use this feature with caution since its execution causes an unconditional jump ignoring any type of nesting limitations.
Last edited on
Topic archived. No new replies allowed.