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
false, or looping through code once per element in a collection of objects. (See the section “Working with Groups of Items” later in this chapter.)
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