Chapter Table of Contents

Ch. 9 Arrays

Section Table of Contents

What are arrays? Why do we use them?

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!

Arrays Diagram

https://s3.amazonaws.com/thinkific/file_uploads/288722/images/b53/805/3a0/1591746647719.jpg

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.

Next Section

9.2 Declaring and Initializing Arrays

<aside> ⚖️ Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License.

If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact [email protected] for inquiries.

</aside>