For...Next Statement

Call Statement,Class Statement,Const Statement,Dim Statement,Do...Loop Statement,Erase Statement,Execute Statement,ExecuteGlobal Statement,Exit Statement,For...Next Statement,Function Statement,If...Then...Else Statement,On Error Statement,Option Explicit Statement,Private Statement,Property Get Statement,Property Let Statement,Property Set Statement,Public Statement,Randomize Statement,ReDim Statement,Rem Statement,Select Case Statement,Set Statement,Sub Statement,While...Wend Statement,With Statement Home home | Other Resources other resources | Advertise with us advertise | Link to us link to us | Contact us contact | Bookmark Us!
Google
 
Where can I find good Windows Web Hosting to host my VBScript Site?
You can find good Windows Hosting which support VBScript, ASP, ASP.Net,VisualStudio.Net and MSSQL at a very reasonable low monthly fee at EasyCGI.com and DiscountASP.Net

For...Next Statement

Repeats a group of statements a specified number of times.

For counter = start To end [Step step]
    [statements]
    [Exit For]
    [statements]
Next

Arguments

counter

Numeric variable used as a loop counter. The variable can't be an array element or an element of a user-defined type.

start

Initial value of counter.

end

Final value of counter.

step

Amount counter is changed each time through the loop. If not specified, step defaults to one.

statements

One or more statements between For and Next that are executed the specified number of times.

Remarks

The step argument can be either positive or negative. The value of the step argument determines loop processing as follows:

ValueLoop executes if
Positive or 0counter <= end
Negativecounter >= end

Once the loop starts and all statements in the loop have executed, step is added to counter. At this point, either the statements in the loop execute again (based on the same test that caused the loop to execute initially), or the loop is exited and execution continues with the statement following the Next statement.

Note   Changing the value of counter while inside a loop can make it more difficult to read and debug your code.

Exit For can only be used within a For Each...Next or For...Next control structure to provide an alternate way to exit. Any number of Exit For statements may be placed anywhere in the loop. Exit For is often used with the evaluation of some condition (for example, If...Then), and transfers control to the statement immediately following Next.

You can nest For...Next loops by placing one For...Next loop within another. Give each loop a unique variable name as its counter. The following construction is correct:

For I = 1 To 10
      For J = 1 To 10
            For K = 1 To 10
            . . .
            Next
      Next
Next

VBScriptOnline.com - Call Statement,Class Statement,Const Statement,Dim Statement,Do...Loop Statement,Erase Statement,Execute Statement,ExecuteGlobal Statement,Exit Statement,For...Next Statement,Function Statement,If...Then...Else Statement,On Error Statement,Option Explicit Statement,Private Statement,Property Get Statement,Property Let Statement,Property Set Statement,Public Statement,Randomize Statement,ReDim Statement,Rem Statement,Select Case Statement,Set Statement,Sub Statement,While...Wend Statement,With Statement