reb Posted April 2, 2011 Share Posted April 2, 2011 Hi, I have a 2D Array that I am clearing with a for next loop. I have looked at the arrays in the help file and can't figure a better way of doing it with the available functions. Looked at some (I'm sure not all) array topics on line. #include <Array.au3> Global $i, $NameScore[7][2] $NameScore[1][0] = "1" $NameScore[2][0] = "2" $NameScore[3][0] = "3" $NameScore[4][0] = "4" $NameScore[5][0] = "5" $NameScore[6][0] = "6" $NameScore[1][1] = "1" $NameScore[2][1] = "2" $NameScore[3][1] = "3" $NameScore[4][1] = "4" $NameScore[5][1] = "5" $NameScore[6][1] = "6" _ArrayDisplay($NameScore) ClearNameScore() _ArrayDisplay($NameScore) Func ClearNameScore() For $i = 1 To 6 $NameScore[$i][0] = "" $NameScore[$i][1] = "" Next EndFunc ;==>ClearNameScore Is this the only way to do this. Thanks, REB MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
Andreik Posted April 2, 2011 Share Posted April 2, 2011 Isn't same thing like? $NameScore = 0 Dim $NameScore[7][2] When the words fail... music speaks. Link to comment Share on other sites More sharing options...
JohnOne Posted April 2, 2011 Share Posted April 2, 2011 You probably want 0 to 6 in your for next loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
reb Posted April 2, 2011 Author Share Posted April 2, 2011 You probably want 0 to 6 in your for next loop.I'm not using 0 in my script. That's why I started with 1 But you are right it is there to be used. REB MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
reb Posted April 2, 2011 Author Share Posted April 2, 2011 (edited) Isn't same thing like? $NameScore = 0 Dim $NameScore[7][2] Thank you Andreik That works. I did not know you could re dimension arrays. It's not a good day if you do not learn something new. Thanks again REB I looked in the help file for dim and found this: You should use Local or Global, instead of Dim, to explicitly state which scope is desired for a variable/constant/array. Since I am doing a global I replaced the dim with global and that works too. Edited April 2, 2011 by reb MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now