×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

two-dimensional array declaration

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?

RE: two-dimensional array declaration

I found this at:http://asp-help.com/getstarted/ms/vbscript/31.htm


...
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 can't do an assignment and a dim on the same line.
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close