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 : 2D Array

2018-01-08
// declare and assign values
redim robs2DArray(2,2)
robs2DArray(0,0)="top left"    : robs2DArray(0,1)="top center"    : robs2DArray(0,2)="top right"
robs2DArray(1,0)="middle left" : robs2DArray(1,1)="middle center" : robs2DArray(1,2)="middle right"
robs2DArray(2,0)="bottom left" : robs2DArray(2,1)="bottom center" : robs2DArray(2,2)="bottom right"

// loop through array items
Dim i, j
For i = 0 To UBound(robs2DArray,1)
    For j = 0 To UBound(robs2DArray,2)
        Response.Write "<br>robs2DArray(" & i & "," & j & ") = " & robs2DArray(i,j)
    Next
Next

//Output
// robs2DArray(0,0) = top left
// robs2DArray(0,1) = top center
// robs2DArray(0,2) = top right
// robs2DArray(1,0) = middle left
// robs2DArray(1,1) = middle center
// robs2DArray(1,2) = middle right
// robs2DArray(2,0) = bottom left
// robs2DArray(2,1) = bottom center
// robs2DArray(2,2) = bottom right