Shanheavel Posted August 14, 2013 Posted August 14, 2013 (edited) I've noticed a strange phenomenon, namely the script loops indefinitely when I use "Array" word in the string. Try this: #include <Array.au3> Global $aStrings = StringSplit("Apple,Orange,Array,Milk", ",") _ArrayDisplay($aStrings) For $array = 1 To $aStrings[0] MsgBox(32, "", $aStrings[$array]) Assign($aStrings[$array], $aStrings[$array], 2) Next It never ends, right? Now try another one. Just change "Array" to "Cola" for example. It should works fine. I'm not sure, is it a bug? Edited August 14, 2013 by Shanheavel Carolina 1
Solution FireFox Posted August 14, 2013 Solution Posted August 14, 2013 (edited) Hi,"Array" corresponds to your variable $array when it's assignated (autoit is case-insensitive).Thus you change the $array value and the loop never ends.Edit: Not tested, it's a suggestion and I may be wrong...Edit: Yeah, the $array var changes to "Array" (interpreted as 0 for a variable type number).Br, FireFox. Edited August 14, 2013 by FireFox
Shanheavel Posted August 14, 2013 Author Posted August 14, 2013 Hi, "Array" corresponds to your variable $array when it's assignated (autoit is case-insensitive). Thus you change the $array value and the loop never ends. Edit: Not tested, it's a suggestion and I may be wrong... Edit: Yeah, the $array var changes to "Array". Br, FireFox. Yea, now it makes sense. However $array in loop is local and "Array" is global variable... but okay. Thanks for fast reply. I think that thread is closed.
FireFox Posted August 14, 2013 Posted August 14, 2013 (edited) Yea, now it makes sense. However $array in loop is local and "Array" is global variable... but okay.You change the $array variable in the loop so it's the same scope.And $array is declared in the global scope here, if your code is not inside a function. Edited August 14, 2013 by FireFox
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