All Functions
Dim Statement
LBound Function
ReDim Statement
FUNCTION: UBound( )
UBound
(ArrayName,
Dimension
)
The
UBound
function returns the upper limit for the number of elements in an array (the elements can be empty).
There is one mandatory argument.
ArrayName
The
ArrayName
argument is the name of the array. Do not include the parenthesis with the array name.
Code:
<% Dim katarray(5) %>
<% katarray(0) = "Mountain lion" %>
<% katarray(1) = "Bobcat" %>
<% katarray(2) = "Jaguar" %>
<% =UBound(katarray) %>
Output:
5
There is one optional argument.
Dimension
The optional
Dimension
argument is used to identify which index you are determining the upper bounds for in a multi-dimensional array.
Code:
<% Dim arrayfish(4,6) %>
<% arrayfish(0,0) = "Neon tetra" %>
<% arrayfish(0,1) = "Angle fish" %>
<% arrayfish(0,2) = "Discus" %>
<% arrayfish(1,0) = "Golden dojo" %>
<% arrayfish(1,1) = "Clown loach" %>
<% arrayfish(1,2) = "Betta" %>
<% =UBound(arrayfish, 2) %>
Output:
6
Copyright 1999-2004 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information