Possible Duplicate:
is while(true) bad programming practice?
What's the point of using “while (true) {…}”?
I've always considered it bad practice to use while(true)
. Many people think it's okay.
Why would you want to purposefully create an infinite loop? The only two reasons I can think of are:
- You're being devious
- You're being lazy
When, if ever, is it appropriate to use this? And why would you use this over an algorithm?