Array

An array is a data structure that holds a collection of items, such as numbers or strings. It allows you to store multiple values in a single variable.

Arrays are indexed, meaning each item has a position (index) that starts from zero. For example, in a list of colors:

[
  "Red",
  "Green",
  "Blue"
]

Here, β€œRed” is at index 0, β€œGreen” is at index 1, and β€œBlue” is at index 2. You can access any color by its index.

You could also have an array of numbers like this:

[
  10,
  20,
  30,
  40
]

Arrays are useful for managing lists of data efficiently, allowing for easy access and manipulation of items based on their index.