Your full service technology partner! 
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

-Collapse +Expand ASP Classic Store

Prestwood eMagazine

February Edition
Subscribe now! It's Free!
Enter your email:

   ► KBWebsite Scri...ASP Classic   Print This     
  From the June 2015 Issue of Prestwood eMag
ASP Classic Array (x = Array())
Posted 13 years ago on 3/20/2010 and updated 3/7/2011
ASP Classic Code Snippet:
 A flashcard from our ASP Classic Flashcards Library
 A code snippet from our ASP Classic Code Snippets Page
 Tags: ASP Classic , Array


Languages Focus: Array

A data structure in which individual values (called elements or items) may be located by reference to one or more integer index variables, the number of such indices being the number of dimensions in the array.

Arrays can start with an index value of 0 or 1, sometimes referred to as 0 based or 1 based.

ASP Classic Array

Arrays in ASP Classic use a 0-based indice.

Use UBound to get the number of elements. UBound returns -1 if the array has no elements, 0 if it has 1, 1 if it has 2, etc.

Syntax Example:
Dim MyArray, i
MyArray = Array("Mike", "Lisa", "Felicia", "Nathan")
If UBound(MyArray) > -1 Then
  For i = 0 to UBound(MyArray)
    Response.Write MyArray(i)
End If

Dynamically sized Arrays

Dim myArray()
Dim ArrayItem
ReDim Preserve myArray(0)     '>>>0 based array.
myArray(0) = "Nathan"
ReDim Preserve myArray(1)
myArray(1) = "Felly"
''Loop thru array.
For Each ArrayItem In myArray

 Response.Write ArrayItem



In addition to using a for each loop above, you can use a for loop as follows:

Dim myArray
Dim ArrayCounter
'...populate array here...
For ArrayCounter = 0 to UBound(myArray)
 Response.Write myArray(ArrayCounter)


Share a thought or comment...
Comment 1 of 2

I use Classic Array where it needed and most of the time I make sure it doesn‘t make code complicated. The also publish a guide where they define the benefits of it.

Posted 29 months ago

Comment 2 of 2

من أجل حل المشاكل مع آلام الحيض ، أود أن أوصي لكم جميعا في محاولة لدفع انتباهكم إلى هذا الموقع ، حيث تمكنت من حل مشاكل من هذا النوع

Posted 28 months ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P147A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.


1 Intermediate Level Question

Question #1: Yes or No?

Are arrays in ASP Classic zero-based?

  • Yes
  • No

  •  KB Article #102133 Counter
    Since 3/20/2010
    Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

    ©1995-2023 Prestwood IT Solutions.   [Security & Privacy]