Array

An array is a data structure that stores multiple values in a single variable, accessed by their position (index). Most arrays count from index 0.

General Programming

Arrays keep an ordered collection of items together so you can loop over them, sort them, or grab one by its index. In Python the everyday equivalent is the list.

Examples

Python

colors = ["red", "green", "blue"]
print(colors[0])

Output:

red

JavaScript

const colors = ["red", "green", "blue"];
console.log(colors[0]);

Output:

red

See also

Back to the Dictionary