image

WHEN YOU LEARN an interesting fact about birds or the name of a new friend, you store it in your memory. In the same way, when a computer keeps track of your score in a game or remembers your name, it’s using computer memory.

In your head, you remember facts and figures by giving them names. Without a name, any fact or figure is useless. For example, the number 15,000 is just a number. But with a name, it becomes an interesting thing to remember, for example:

Elephants can weigh as much as 15,000 pounds!

Computers remember things in the same way as you do. In programming languages, the name that’s given to something you want the computer to remember is called a variable.

In this adventure, you find out how to use variables in Scratch to remember and keep track of things.

Understanding Variable Blocks

Variables are like boxes into which you can put any combination of words, numbers, dates, or other values that you want to use or remember in your program.

If you want to write a program that asks a user to input the answers to several questions, you can use the ask () and wait block that you learned about in Adventure 4. After each question is asked, the answer is placed ...

Get Adventures in Coding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.