Does goto have a glitch or...?
Ok, many people dislike goto. As far as I can tell, its just cause it makes the code slightly ugly. But, I thought about it; I built a loop and a function to make a repeating structure that called itself.
Then, I remembered the evil goto of doom!
Code:
ninty:
if(x < Ens.size() && Ens.size() > 1) {
x++;
ymir = FindEnemy(x);
if(ymir.IsNull())
Ens.pop_back();
goto ninty;
}
This replace my function, my for loop, everything! But, then I thought, their must be a reason people dont use this... Its pritty hated as far as I can tell... Is their an actual error with the goto statement? Its not a giant loop, its definantly replacable. But its a very nice timesaver, but I dont want to go getting used to error-prone code. (I dont mean logic errors that can be built using goto, I mean built-in errors with the literal goto statement)
Thanks!