[thelist] ASP Array Question

Warden, Matt mwarden at mattwarden.com
Fri Nov 30 14:05:31 CST 2001


On Nov 30, Josh Feingold had something to say about [thelist] ASP Array Question

>I am working with arrays in ASP and want to make the index of the array a 
>variable.
>
>e.g.
>dim first_array(10)
>
>for x = 1 to 10
>first_array(x) = "This stuff"
>next

You realize arrays are 0-based, right? In other words, the first item is
myArray(0) not myArray(1).

>That does not work, nor does a two-diminsional array such as:

You sure? How are you spitting it back out to test it? Or... are you
getting an error?

>dim second_array(2,3)
>
>for x = 1 to 10
>second_array(x,3) = "This stuff"
>next

Well, that makes no sense. After x=2, you will have gone beyond the bounds
of the array and all the way to second_array(10, 3)

>However this seems to work:
>
>dim third_array(2,3)
>
>for x = 1 to 10
>third_array(3,x) = "This stuff"
>next

Hmmm... I'd be interested in how you are determining whether it works or
not.

>Based on all of this it seems that the index must be a number and can't be 
>inserted via a variable even if the variable is a number.

Not true.

Let me see what you're using to test these.

Thanks,

--
mattwarden
mattwarden.com







More information about the thelist mailing list