This chapter is about the how: the everyday code you write with arrays. Every snippet comes in JavaScript, Python, Java and C++ — pick your language on any code box and the site remembers it for every lesson.
Read nums[2] aloud as "nums at index 2". Indexes count from 0, which feels odd at first: the index is really a distance from the start, and the first element is zero steps away. The last element of an array of length n is therefore at index n - 1.
Free account
Sign up to read the rest of this lesson: 4 more sections and code in JavaScript, Python, Java and C++.
Still to come