RoundChecker Posted December 19, 2017 Author Share Posted December 19, 2017 Yes I did understand that, the array starts with value 0, then 1 then 2 then 3 then 4 then 5 ... etc What I meant is that "1 to UBound($cArr) -1" In our example of the arrays; Global $cArr[4] = [17, 18, 19, 20] 1 would be the first value of those 4, then when finished summing up with UBound($cArr)-1 then that "1" is the value 0 out of 3 (which is 17) in our case, correct? Link to comment Share on other sites More sharing options...
kaisies Posted December 19, 2017 Share Posted December 19, 2017 3 minutes ago, RoundChecker said: Yes I did understand that, the array starts with value 0, then 1 then 2 then 3 then 4 then 5 ... etc What I meant is that "1 to UBound($cArr) -1" In our example of the arrays; Global $cArr[4] = [17, 18, 19, 20] 1 would be the first value of those 4, then when finished summing up with UBound($cArr)-1 then that "1" is the value 0 out of 3 (which is 17) in our case, correct? No, 1 is the second value, 18. 0 is the first value, 17. Global $cArr[4] = [17, 18, 19, 20] Msgbox(0,'',$cArr[1]) ;Shows 18 Msgbox(0,'',$cArr[0]) ;Shows 17 For $x = 0 to 0 Msgbox(0,'',$cArr[$x]) ;Shows 17 Next For $x = 1 to UBound($cArr)-1 Msgbox(0,'',$cArr[$x]) ;Shows 18, then 19, then 20. Next Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Author Share Posted December 19, 2017 To make it more clear: Global $cArr[4] = [0, $a, $a1 $a2] This has an array of 4, 4 elements included, 4 values. The values are from 1 - 4 . the arrays are from 0 to 3. Where as in this example 0, is 0 (first Array) (First Element) And where 3 is $a2. ( our 4th element ) so $k = 1; < This 1, means the first element in our array, from the 4, correct? to UBound. . . > Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Author Share Posted December 19, 2017 So $cArr[0] would be 0, [1] would be $a, [2] . . . and so on, in my point was that $k = 1 < this represents the first element in the arrays, correct? which is [0] Link to comment Share on other sites More sharing options...
kaisies Posted December 19, 2017 Share Posted December 19, 2017 2 minutes ago, RoundChecker said: So $cArr[0] would be 0, [1] would be $a, [2] . . . and so on, in my point was that $k = 1 < this represents the first element in the arrays, correct? which is [0] $k = 1 Does not represent anything. It is initializing the variable $k with the value 1. In the context of looping through an array, it would start with index 1, or [1]. RoundChecker 1 Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Author Share Posted December 19, 2017 Oh okay, so that's why i was advised to put [0, $a..] so 0 wont be in the search of the context of looping through arrays, and it would start from $a to $a2 - Thanks now I get it much appreciated ! Link to comment Share on other sites More sharing options...
Earthshine Posted December 19, 2017 Share Posted December 19, 2017 (edited) k is only the Iterator. using k=1 starts the array at element 0 in the loop and continues works the same in C/C++/C# etc. Edited December 19, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Author Share Posted December 19, 2017 Yeah figured, thanks, was just making sure I'm on the same term so I won't have faulty coding in the future when it comes to autoIT Link to comment Share on other sites More sharing options...
Deye Posted December 19, 2017 Share Posted December 19, 2017 The 0 was for returning a valid false from the function we used Btw a typo in myprevious post oops .. 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