Codecademy Logo

Learn How to Code with Blockly: Lists

Data Structure Definition

In programming, data structures are an organized way to access and manage data.

List Definition

In programming, lists are a basic data structure that stores multiple pieces of information in an ordered, linear sequence.

myList = ["apple", "banana", "grapes"]

List Index Definition

In programming, the position of a value in a list is known as its index. An item in a list can be accessed by its index.

myList = ["apple", "banana", "grapes"]
myList[1] //returns ‘banana’, if a list is zero-indexed

List Append Definition

In programming, when item is added to the end of a list, this is known as appending.

myList = ["apple", "banana", "grapes"]
myList.append("pear") // adding an item to the end of a list in javascript
// returns ["apple", "banana", "grapes", "pear"]