Beginner
20 mins
50 points
What you need:
  • Computer/laptop

What is an array?

Learn what arrays and lists are and how we use them in coding.

1 - What is an array?

An array or list is a group of values stored in a collection. These values may be added to, changed or rearranged.

For example in a game we could have an array called "top scores" and this would store the 10 highest scores of the game along with the player's name.

Top Scores

  1. 482 - Gamerboy
  2. 470 - SteveO
  3. 465 - NinJane
  4. 430 - Zeplin
  5. 382 - Speedster

2 - Changing the items

Once we create an array we can:

  • Add items to it add 465 - NinJane to [top scores] 
  • Delete items from it delete 1 of [top scores] (where 1 is the index of the item you want to delete)
  • Delete all of the items in the array delete all of [top scores] 
  • Retrieve an item from the array item 1 of [top scores] 
  • Get the amount of items in the array length of [top scores] 
  • Check if it contains a specific item [top scores] contains thing ? 
  • Replace an item in an array with a different item replace item 1 of [top scores] with thing 



Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more