two-dimensional array declaration
two-dimensional array declaration
(OP)
Can I declare a two or more dimensional array in vbscript using one line declarations? For example, a one dimensional array can be declared like this:
dim weekdays(6) = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
(or something similar)
as opposed to this:
dim weekdays(6)
weekdays(0) = "Monday"
weekdays(1) = "Tuesday"
weekdays(2) = "Wednesday"
weekdays(3) = "Thursday"
weekdays(4) = "Friday"
weekdays(5) = "Saturday"
weekdays(6) = "Sunday"
Can this be done with a two or more dimensional array?
dim weekdays(6) = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
(or something similar)
as opposed to this:
dim weekdays(6)
weekdays(0) = "Monday"
weekdays(1) = "Tuesday"
weekdays(2) = "Wednesday"
weekdays(3) = "Thursday"
weekdays(4) = "Friday"
weekdays(5) = "Saturday"
weekdays(6) = "Sunday"
Can this be done with a two or more dimensional array?
RE: two-dimensional array declaration
...
The notation used to refer to an element of an array consists of the variable name followed by parentheses containing
an index number indicating the desired element. In the following example, the first statement creates a variable named
A. The second statement assigns an array to variable A. The last statement assigns the value contained in the second
array element to another variable.
Dim A
A = Array(10,20,20)
...
RE: two-dimensional array declaration
You could use a method like this:
dim weekdays
weekdays=split("Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", ",")
This will give you an array filled with your values.
nick bulka
nick@bulka.com