August 2010
Intermediate to advanced
1224 pages
34h 17m
English
There are many times in your code when you need to execute a set of statements more than once. In these cases, you need to create a loop. The most common scenarios are looping through code a set number of times, looping until a condition becomes true or false, or looping through code once per element in a collection of objects (see working with groups of items later in this chapter).
The For...Next construct enables you to execute a block of code statements a set number of times. This is accomplished through a counter that increments a set number of steps each time the loop executes. After the counter has reached a max value the looping completes.
In C#, you write a for statement inside parentheses. The for statement has three ...