Sign in to follow this  
Followers 0
redndahead

Array Problems

3 posts in this topic

I am setting an array something like

DIM $Array[10]
$num = 0
For $i = 1 to 2
   $num = $num +1
   $Array[$i] = $num
Next

Msgbox(0,"",$array[0])
Exit

My assumption is that I should get 2 in the messagebox. I always get 0 no matter what is in my array. Am I missing something? If I check $array[1] and $array[2] they do have values to them.

red

Share this post


Link to post
Share on other sites



You're starting your For loop at 1 so $array[1] and $array[2] are being set, but $array[0] is never set and it's defaulting to 0.

Share this post


Link to post
Share on other sites

Yeah I'm a dumbass. I thought since when you used Stringsplit() the array created said the nbr of items in the array i thought all arrays did that. Duh I just set the array manually. Easy.

:iamstupid:

red

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0