Skip to main content
Module 4~9 min

Arrays and Lists

Programs often need to work with many related pieces of data at once. Arrays (also called lists) let you group them together.

What You'll Learn

  • What an array is
  • How items in an array are accessed
  • A simple use case for arrays

Grouping Related Data

An array is an ordered collection of values stored under a single variable name, making it easy to work with many related items together instead of one at a time.

Accessing Items by Position

Each item in an array has a position, called an index, usually starting at zero. You can access or change a specific item using its index.

Example

An array of three colors might store ["red", "green", "blue"] -- the first item, "red", would be at index 0.

Key Concepts

ArrayIndexCollection

Key Takeaways

  • An array is an ordered collection of values under one variable name
  • Each item in an array has a position called an index
  • Arrays make it easy to work with many related items together

Knowledge Check

What is an array?

What is an array?