Variables & Lists
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".
- When green flag clicked
- Set score to 0
- Forever
- If touching (Star)? then
- Change score by 1
- 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.