Chapter 8. Looping Structures

If you couldn’t create loops, you’d often have to write hundreds or thousands of lines of code instead. The basic idea of all types of loops is the same—to reduce the number of code statements needed to repeatedly perform a task. Loops come in a number of different flavors, and you should use the appropriate type in any given situation. Some loops execute a specific number of times, while others execute as long as a certain condition is True. Using the correct loop for a job can mean more solid, efficient, and readable code.

Tip

One key to writing efficient code is to eliminate redundancy. If you find yourself typing the same (or similar) lines of code repeatedly, chances are good that you should create a loop. ...

Get Practical Standards for Microsoft® Visual Basic® .NET, Second Edition 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.