Login | |
|
 |
Array String Number... - 5/9/2008 11:25:56 AM
|
|
 |
|
| |
semihcan
Posts: 2
Score: 0
Joined: 5/9/2008
Status: offline
|
here is my arrays : a1=Array(1,2,3,4,5,6,7,8,9) a2=Array(11,2,3,4,5,6,7,8,9) a3=Array(111,2,3,4,5,6,7,8,9) a4=Array(1111,2,3,4,5,6,7,8,9) a5=Array(11111,2,3,4,5,6,7,8,9) here is the loop For i = 1 to 5 msgbox a&i&(0) Next i expected : 1 11 111 1111 11111 but gives error how can i get the array values? i can not tell the machine that a&i&(0) equals a1(0) => 1 a&i&(0) equals a2(0) => 11 a&i&(0) equals a3(0) => 111 a&i&(0) equals a4(0) => 1111 a&i&(0) equals a5(0) => 11111 please help me!!!
|
|
| |
|
|
|
 |
RE: Array String Number... - 5/9/2008 9:18:45 PM
|
|
 |
|
| |
mcnd
Posts: 23
Score: 0
Joined: 4/27/2008
Status: offline
|
why not dim a a = Array( Array(1,2,3,4,5,6,7,8,9) , _ Array(11,2,3,4,5,6,7,8,9) , _ Array(111,2,3,4,5,6,7,8,9) , _ Array(1111,2,3,4,5,6,7,8,9) , _ Array(11111,2,3,4,5,6,7,8,9) ) dim i for i = 0 to 4 wscript.echo a(i)(0) next Just fastest as it does not use the "expensive" Eval
|
|
| |
|
|
|
 |
RE: Array String Number... - 5/10/2008 4:23:18 AM
|
|
 |
|
| |
dm_4ever
Posts: 2433
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Very good point mcnd....I guess it really depend on what the final objective of the scripter is...it could be that this is just something they are playing with to do something similar or different. If they intend on using something similar to what was posted then yes, your method is faster and should be used if the final script will contain many more arrays with more elements.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|