Chapter 4. Using Constants and Enumerations

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.


 

 

Goals of Using Looping Structures

Looping structures are great for

  • Reducing repetitive code

  • Iterating through an array or a collection

  • Increasing the speed and efficiency of your code

 



Practical Standards for Microsoft Visual Basic. NET
Practical Standards for Microsoft Visual Basic .NET (Pro-Developer)
ISBN: 0735613567
EAN: 2147483647
Year: 2005
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net