Entering the loop1. Enter the loop from one location online. Put initialize code directly before the loop.3. In C and java, use for infinite loops.4. On't us @ do't us (TRUE) a for loop when a while loop is more appropriate.
Processing the middle of the loop1. Use {and} to enclose the statements in a loop.2. Avoid empty loops.3. Keep loop-hosekeeping chores at either the beginning or the end of the loop.4. Make each loop perform only One function.
Exiting the loop1. Assure yourself that the loop ends.2. Make loop-termination conditions obvious.3. Do not monkey with the loop index of a for loop to make the loop terminate.4. Avoid code that depends on the loop index's Final Value.5. Consider Using Safety Counters
Exiting loops early1. Consider using break statements rather than boolean flags in a while loop.2. Be wary of a loop with a lot of breaks scattered through it.3. Use continue for tests at the top of a loop.4. Use labeled Break if Your language supports it.5. Use break and continue Only with.
Using loop variables.1. Use ordinal or enumerated types for limits on both arrays and loops.2. Use meaningful variable names to make nested loops readable.3. Use meaningful names to avoid loop-index cross talk.4. Limit the scope of Loop-index variables to the loop itself.
HOW Long Should a loop be1. Make your loops short enough to view all at overce.2. Limit Nesting to three levels.3. Move Loop Innards of long loops inTo routines.4. Make long looops especially clear.