O'Reilly logo

Adventures in Coding by Chris Minnick, Eva Holland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required