NEW Explore the Scratch Block Dictionary, tutorials, textbook, and classroom guides

Start learning →

Variables & Lists

📌 What you will learn

Use variables to remember scores, lives, and speed, and use lists to manage inventories, quizzes, and map data.

A variable is a labeled box

Think of a variable as a box with a name written on the outside, like "score" or "lives". You can look inside at any time, replace the value with "set", or add and subtract with "change".

Initialize and update a score
  1. When green flag clicked
  2. Set score to 0
  3. Forever
  4. If touching (Star)? then
  5. Change score by 1
  6. Wait 0.5 seconds

Try it: The score starts at 0 every game and increases by 1 whenever the player touches the star.

When to use a list

When you need to remember many items in order—such as quiz questions, high scores, or an item inventory—a list is much cleaner than creating ten separate variables.

  • Use "For all sprites" for shared values like score or timer.
  • Use "For this sprite only" when each clone needs its own health or speed.
  • Always reset variables and clear temporary lists when the green flag is clicked.

This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.