For ... Next Loop

Repeat a block of statements a given number of times.

Syntax 
      For counter = initial_value To Max_value [Step stepCounter]
         [Statements]
         [Exit For]
      Next [counter]

Key
   counter     A numeric variable

   initial_value A numeric expression for the starting value

   Max_value   A numeric expression for the maximum value

   stepCounter A numeric expression for the increment of counter

The counter may be either incremented or decremented with a positive or negative value for stepCounter.

Example

  For i = 1 to 20
     WScript.Echo i
  Next

“Profit in business comes from repeat customers, customers that boast about your project or service, and that bring friends with them” ~ W. Edwards Deming

Related:

Do..Loop - Repeat a block of statements
For Each... - Loop through the items in a collection or array
Equivalent Powershell command: For


© Copyright SS64.com 1999-2014
Some rights reserved