Count-Controlled Repetition
Count-controlled repetition requires
A count-controlled repetition will exit after running a certain number of times. The count is kept in a variable called an index or counter. When the index reaches a certain value (the loop bound) the loop will end. Count-controlled repetition is often called definite repetition because the number of repetitions is known before the loop begins executing. When we do not know in advance the number of times we want to execute a statement, we cannot use count-controlled repetition. In such an instance, we would use sentinel-controlled repetition.
|
Loops while do...while for Control Structure Loop Design Methodology Common Loop Errors |
|
Fook Yuen Sin - Team 1 |