Directives
8.1 Use For…Next to loop a specific number of times.
The most basic type of loop is the For…Next loop, which loops a specific number of times. When the maximum number of iterations is reached, execution continues with the statement following the Next statement. When you create a For…Next loop, you designate the starting number to use for counting as well as the ending number. You can also specify an increment by using the Step keyword.
The For…Next construct has the following syntax:
For counter = start To end [Step step] [statements] [Exit For] [statements] Next [counter]
The For…Next construct has these parameters:
counter
A required numeric variable used as a loop counter. The variable can’t be a Boolean or ...
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.