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.

Examples

  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 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 SS64.com
Some rights reserved