Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











FUNCTION:  Array( )

Implemented in version 2.0
 
Array(List)
 
The Array function is used to create a static one-dimension array. You cannot declare a dynamic array using the Array function.
 
Note that the first element in an array is always labeled zero, for example,
myarray(0).
 
The List argument is a listing of values that will become the elements of the array.
 
Code:
<% myarray = array("A", "B", "C", "D") %>
<% =myarray(0) %>
<% =myarray(1) %>
<% =myarray(2) %>
<% =myarray(3) %>

 
Output:
A
B
C
D

 
Code:
<% myarray = array(111, 222, 333, 444, 555) %>
<% =myarray(0) %>
<% =myarray(1) %>
<% =myarray(2) %>
<% =myarray(3) %>
<% =myarray(4) %>

 
Output:
111
222
333
444
555

 
A dynamic array is declared using the Dim and the ReDim statements. First, you use the Dim statement to declare the dynamic array by using empty parenthesis. Then, at a later point in your program, you use the ReDim statement to declare the number of elements. In fact, you can re-declare a dynamic array as many times as you desire.
 
Code:
<%
Dim SomeArray()
...
ReDim SomeArray(22)
...
ReDim SomeArray(500)
%>

 
Arrays can have up to sixty dimensions. If you wish to create a multiple-dimension array, you need to declare it using the Dim statement. For example, the following code creates a three dimensional array. The first dimension has 23 elements, the second dimension has 15 elements and the third dimension has 201 elements. Therefore, there are a total of 23x15x201 = 69345 elements in this array.
 
The number of dimensions that you can create is limited by the available memory. If you exceed the available memory while declaring an array, you will get an error message.
 
Code:
<% Dim ThreeDimensionArray(22, 14, 200) %>


 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information