1.

Why Is The Use Of Exit Do Or Exit For Statements Within Loops Discouraged?

Answer»

These statements are acceptable for specific conditions, but they often make code less readable, which makes it difficult for others who look at your code to know what's really going on. If you make sure the only way out of a loop is to not satisfy the loop's condition, it's much easier to FOLLOW your code. Often, BREAKING out of a loop by force with an exit statement is a sign of a poorly CONSTRUCTED loop with a condition that does not meet your GOALS. TAKE a look at the loop structure and condition again to make sure you're not leaving something out.

These statements are acceptable for specific conditions, but they often make code less readable, which makes it difficult for others who look at your code to know what's really going on. If you make sure the only way out of a loop is to not satisfy the loop's condition, it's much easier to follow your code. Often, breaking out of a loop by force with an exit statement is a sign of a poorly constructed loop with a condition that does not meet your goals. Take a look at the loop structure and condition again to make sure you're not leaving something out.



Discussion

No Comment Found