© Eduardo A. Vlieg 2016

Eduardo A. Vlieg, Scratch by Example, 10.1007/978-1-4842-1946-1_8

8. Variables

Eduardo A. Vlieg

(1)Curacao, Curaçao

To temporarily hold information and pass it to other blocks in your script, you can create variables. Each variable you create in Scratch has a unique name and can hold either a numeric value or a string of characters. A string can be an actual word or any combination of letters, numbers, and symbols, like in a password. For example, you could create a variable called City and give it the value Boston. Later in your script, you can set City to another value, such as New York. Variables come in handy whenever you need to use data values that change in a script. For example, suppose that you wanted the cat to ...

Get Scratch by Example: Programming for All Ages 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.