ASP

ASP Variables Strings Form Arrays 2D Array Loop IF Cookies Dates Dictionaries SQL Numbers Files JSON Database Regular Expression ExecuteGlobal Recordset ServerVariables Bugs ADO AJAX XML Chilkat
O O

Weather Controls

Time Of Day
Rain
Wind Speed
Wind Direction
Clouds

ASP : Loop

2017-01-01

Loop

For Loop

Basic

For i=0 To 5
    response.write i
Next

Step keyword - Increased by 2 each iteration

For i=2 To 10 Step 2
  response.write i
Next

Exit For Loop

if i = 3 then exit for

For Each Loop

colorArr = array("blue","red","purple")

For each color in colorArr
    response.write "color: " & color
Next

While Loop

Used to loop through a record set.

While NOT rsInfo.EOF
    response.write rsInfo("Column_name")
    rsInfo.MoveNext
Wend

Do Loop

When iteration count is unknown. Can be used to do at least one iteration. While or Until.

Do Until i=10
  i=i+1
  If i>10 Then Exit Do
Loop