Static Arrays
<%@ LANGUAGE="VBSCRIPT" %> <% 'Use the Dim statement along with the array name 'to create a static VBScript array 'The number in parentheses defines the array’s upper bound Dim arrCars(4) arrCars(0)="BMW" arrCars(1)="Mercedes" arrCars(2)="Audi" arrCars(3)="Bentley" arrCars(4)="Mini" 'create a loop moving through the array 'and print out the values For i=0 to 4 response.write arrCars(i) & "<br>" Next 'move on to the next value of i %>
Here is another way to define the array in VBScript:
<%
'we use the VBScript Array function along with a Dim statement
'to create and populate our array
Dim arrCars
arrCars = Array("BMW","Mercedes","Audi","Bentley","Mini") 'each element must be separated by a comma
'again we could loop through the array and print out the values
For i=0 to 4
response.write arrCars(i) & "<br>"
Next
%>
