Jump to content

isArray


Recommended Posts

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

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

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

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].

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...