Guidelines for Choosing
a Looping Statement
• For count-controlled loops, think for.
• If you know it will execute at least once,
do-while is good for event control.
• If you don’t know whether the loop will
ever execute, use a pretest loop (while or
for).
• When in doubt, use a while statement.