Chapter Table of ContentsSection Table of ContentsWhat are arrays? Why do we use them?Arrays DiagramNext Section
When you want to organize a large set of data, arrays are really helpful. They are a powerful tool for structuring data and pop up in almost every coding language. Arrays can be one-dimensional (1D) or multi-dimensional (usually we only go up to 2D arrays). Arrays can store primitives and non-primitives. So let’s start playing with them!
Just as with strings the indices of arrays start at zero. Thus if you tell the compiler to return you the length of the array below (using
nameOfArray.length), it will return 10, but the indices (for example in your for loop which you will use to iterate through the array) will only go up till 9.