+ 3
Summing Elements in an Array Question
Why do we have to add x<myarr.Length as a condition in the for loop when trying to add up elements in an array? What purpose does it serve? Can someone also describe how this code works because my idea of it is pretty foggy?
1 Answer
+ 1
To get element x of array you have to iterate over array.
x<myArr.length means that you iterate to the last element of array.