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

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

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