Next: Exercise. Up: More about loops. Previous: Labeled break and continue statements.


On the usefulness thereof

These constructs we've discussed today - the do loop, the continue statement, and the labeled break statement are much less frequently used than the other loop concepts we've discussed so far. To get a feel for how useful they are, I counted how often different statements occurred in the code for Logisim and the 150 CPU simulator, which together contain 12,000 lines of code.

while loop122 times
for loop120 times
do loop0 times
break statement166 times
continue statement3 times
labeled break or continue0 times


Next: Exercise. Up: More about loops. Previous: Labeled break and continue statements.