ASPNL logo (1 kb)
Thursday, November 20, 2008

powered by


Microsoft ASP.NET Connections
Member of ASP Guild
<< previous | index | next >>

Working with arrays

An array is a variable that can contain more than one value at the same time. Every value has a different place in the array that's desided by an index. These values can, just like with normal variables, be changed as the code is executed.

An array is declared in the same way as an ordinary variable, but how many values should fit in the array is given between parentheses.

array1.asp
<%
Option Explicit

Dim MyArray(3)

MyArray(0) = "Pete"
MyArray(1) = "John"
MyArray(2) = "Mark"
%>
<HTML>
<BODY>
<%
Response.Write "Names:<br>"
Response.Write MyArray(0) & " <br>"
Response.Write MyArray(1) & " <br>"
Response.Write MyArray(2) & " <br>"
%>
</BODY>
</HTML>


<< previous | ^ to top | index | next >>
copyright 2000-2002 ASPNL