image

IN THE LAST adventure, you learned about variables and lists in Scratch. Variables and lists are boxes that you use for holding numbers or text. After you have numbers or text in a program, you can do all sorts of things with them, such as adding the numbers together or joining text.

In this adventure, you learn about the Scratch blocks that make it possible to combine, change, add, multiply, divide, and transform variables and values. Welcome to the fascinating world of the operator blocks!

Saying Hello to the Operators

The Operators Block Palette contains 17 blocks. These blocks all have one thing in common: They take one or more values and use them to produce some other value. When you use values to produce other values in programming, it’s called “performing an operation.” The blocks that make operations possible are called “operators.”

Figure 7-1 shows all the operator blocks.

image

Figure 7-1 The operator blocks

Operators are powerful blocks. Understanding and mastering them is the key to being able to do all sorts of useful and essential things in your projects. Some of the things they make possible ...

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.