Electrical and Computer Engineering
30
of 31
UAH
CPE 112
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 dont know whether the loop will
ever execute, use a pretest loop (
while
or
for
).
When in doubt, use a
while
statement.