Arrays are without a doubt mans best friend.
Sorry dogs but I think you now come in second. There are
many ways to use arrays. Here are a couple of quick
examples:
Now you may be wondering, Why did he dimension his array
as 2 when there are three parts to it. Well, arrays are ZERO
based so even though there are three parts, it actually
counts the first as zero, so instead of it counting 1, 2, 3,
it counts 0, 1, 2.
Now let's go a little further and Split a string into an
array.
<%
Dim strPaco, arrPaco
strPaco = "Learn about arrays at Paco's"
arrPaco = Split(strPaco," ")
For i = 0 to UBound(arrPaco)
Response.Write arrPaco(i) & "<br>"
Next
%>
This would write:
Learn
about
arrays
at
Paco's
Here's basically what happened.
Split() took the string and cut it up every where it
found a blank space. This gave us each individual word. For
i = 0 is starting a loop and setting i to zero which is the
lowest number in an array. Now to UBound(arrPaco) is telling
the loop how many times to loop. UBound simply means UPPER
BOUND or the highest number in the array. In this case it
said start at 0 and loop to 4 (this gives us 5 remember
arrays are ZERO based. The next line:
Response.Write arrPaco(i) & "
<br>"
arrPaco(i) What is the i there for? remember we told this
loop i = 0. Now why is the an ampersand and a break tag?
Well, the & is used to concatenate (glue together)
the break tag and the array so it will write the array and
then move down a line when it performs it' next action. The
word NEXT tells it to do it all over again with the next
word in our array.
And there it is, a very basic, simply spoken set of array
examples.