Arrays
Arrays are simple storage structures that allow us to group similar
data types together for more efficient processing. The following
example define a simple 5 element array of type string which will
hold the first names of the marx brothers.
<html>
<head>
<title>Using arrays</title>
</head>
<body>
<P> Here are the marx brothers:</p>
<%
Dim strMarx()
Redim strMarx(5)
strmarx(0)="Goucho"
strMarx(1)="Harpo"
strMarx(2)="Chico"
strMarx(3)="Zeppo"
strMarx(4)="Gummo"
%>
<P><b>
<% for intCount=0 to 4%>
<%=strMarx(intCounter)%>
<%Next%>
</b></p>
<P>Whoops Nearly forgot the bearded lefitsh one ..</p>
<% Redim preserve strMarx(6) %>
<% strMarx(5)="Karl" %> <p><b>
<% for intcounter=0 to 5%>
<%=strmarx(intCounter)%>
<%next%>
</b></p>
</body>
</html>
How it works:
Redim with the Preserve option resizes the strMarx array to hold
6, values not counting position 0. The preserve option is used to
preserve the contents of the array. Without Preserve , the array
would be initialized to empty.
|