Possible Duplicate:
GOTO still considered harmful?
Recently I’ve been reading “The C Programming Language” by K&R. I don’t know much C, but I know a bit of Java, and on page page 65 (2nd ed.) the writers talk about Goto and how it is almost always unwarrented.
Recently I’ve been writing a game, where the computer must show some primitive level of AI, where I wrote lots of for, whiles, and ifs in Java to emulate some sort of intelligence. As primitive as it was, it there were four-deep embedded “for loops” with if statements all over the place, and by the end I lost track of where to put the breaks and was breaking some loops while still looping through others making my game unplayable. Eventually, after much stress I sorted it.
My questiuon is: How bad is Goto?
If I had a goto in my game (Java doesnt really provide one) I wouldn’t have wasted so much time fiddling with breaks and brackets. Is Goto really so bad? Why are they so hated?
more goto statements in your code less readable would be your code, my opinion