Hi, I was reading something that said goto was bad. Why is it a bad practice to use it?

Recommended Answers

All 3 Replies

>Why is it a bad practice to use it?
Laziness. Most of the time, people who use goto are too lazy to consider all of the alternatives and choose the best solution. They fall back on goto, but because they're lazy, they don't use it wisely and the result is the infamous "spaghetti code" you hear horror stories about.

It's also said to be a bad practice because of ignorance. This has nothing to do with the actual use of goto, but rather an incomplete understanding of the how, why, and when by those who make the most noise about goto being "evil".

However, with that said, if you have to ask why it's a bad practice, you're probably not yet qualified to use it wisely.

commented: Well put! +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.