Skip to Content
Introduction to Lists

At this point, we assume that you’re familiar with arrays: they’re useful tools for managing large amounts of sequential data.

But arrays have their drawbacks:

  • They have a limited length
  • You have to keep track of the number of elements in the array using a separate index
  • You can only edit one element at a time

Lists resolve all of these issues! Like arrays, they are a sequential collection of values and they can hold references to any type. Unlike arrays, they have (effectively) unlimited length, they automatically track the number of actual elements in the list, and they have have handy methods to work with multiple elements at a time.

In this lesson we’ll cover list basics and some common list methods.



This code creates and edits a lists of cities. How does this look different from arrays?

Run the code to see it in action.

Folder Icon

Take this course for free

Already have an account?