For ... Next Loop

Repeat a block of statements a given number of times.

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

   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.


  For i = 1 to 20
     WScript.Echo i

“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 VBScript commands

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

Copyright © 1999-2024
Some rights reserved