7.4. Summary

In this chapter you learned the necessary conditions for writing a well-behaved loop. You then applied those conditions to writing for, while, and do-while loops. You also learned that for loops are ideally suited for counting operations and that while loops are good for searching for a particular value in a set of values. Finally, you learned how to transfer control out of a loop (break) before its natural termination condition is reached, and how to continue processing a loop statement block (continue).

Get Beginning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.