Tutoring

Learn

Resources

Operator Blocks in Scratch | What Are the Components of Operator Blocks

Updated By

Reviewed By

Operator Blocks in Scratch
Image

Scratch is a block-based programming language which means the codes are written in the form of blocks and the user just has to drag and drop the blocks onto the editor and arrange them strategically to run a script.

There are a total of 9 types of blocks in Scratch that can be used to create projects in Scratch. In this blog, we will discuss one of the blocks, operator blocks, in detail.


This is Chapter 4.7 in the
Scratch Tutorial for Beginners


What are Operator blocks in Scratch?

Operator blocks are used to script math equations and string handling. For example, you can use the operator blocks to two numbers together, or search for a letter in a word.

There are a total of 9 categories of blocks in Scratch: Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables, and My Blocks. Each block has a separate function, characteristic, and usage as per the requirement of the project. Operator blocks in Scratch are one of the 9 categories of blocks in Scratch. Operator Blocks are light-green colored blocks specifically used to do mathematics operations and string handling.

In previous versions of Scratch, operator blocks were known by the name of Numbers Blocks.

In the current and latest version of Scratch, there are a total of 18 operator blocks, out of which, 7 blocks are Boolean blocks and the rest 11 blocks are reporter blocks. Boolean blocks are elongated hexagonal blocks that are used to report only Boolean values (‘true’ or ‘false’ OR 1 or 0, depending on the requirements), whereas, Reporter blocks are the blocks that are used to report a value that can be anything from numbers to strings.

Usually, the blocks in Scratch are shaped in such a way that they can be placed above or below other blocks to complete the coding but all the operator blocks are designed in such a way that they can’t be placed above or below other blocks.

Now, let’s have a look at all the Operator Blocks in Scratch separately.

“() + ()” Operator block

This operator block is used to add two values and then report the result. This block comes under the category of reporter blocks. The values can be added directly to the blocks.

“() + ()” Operator block

“() – ()” Operator block

This operator block is used to subtract the second value from the first value and then report the result. This block comes under the category of reporter blocks. The values can be added directly to the blocks.

“() - ()” Operator block

“() * ()” Operator block

This operator block is used to multiply two values and then report the result. This block comes under the category of reporter blocks. The values can be added directly to the blocks.

“() * ()” Operator block

“() / ()” Operator block

This operator block is used to divide the second value from the first value and then report the result. This block comes under the category of reporter blocks. The values can be added directly to the blocks.

If the first value entered is not evenly divisible by the second value, then the reported value will have decimals. To find the exact remainder in this case, you can use the “() Mod ()” operator block.

“() / ()” Operator block

“Pick Random () to ()” Operator block

This operator block returns a random value, including the first and the second number given to it. If both the numbers given to the block are integers, then the number which will be returned will also be an integer. For example, if the numbers are given as 2 and 5, then the returned number will be either 2, 3, 4, or 5.

Similarly, if both the numbers given to the block are float numbers, then the number which will be returned will also be a float number. For example, if the numbers are given as 0.5 and 0.15, then the returned number will be anything between 0.5 and 0.15, up to 17 digits after the decimal.

This block comes under the category of reporter blocks and the values can be added directly to the blocks. Although, the default numbers for this block are 1 and 10.

“Pick Random () to ()” Operator block

“() > ()” Operator block

This operator block reports “true” if the first value entered is greater than the second value and if the first value entered is not greater than the second value, then it will report “false”. This block is also used to compare strings.

This block comes under the category of Boolean blocks and the values can be added directly to the blocks. Although, the default number for this block is 50 and the first number entered is always compared with 50, by default.

“() > ()” Operator block

“() < ()” Operator block

This operator block reports “true” if the first value entered is smaller than the second value and if the first value entered is not smaller than the second value, then it will report “false”. This block is also used to compare strings.

This block comes under the category of Boolean blocks and the values can be added directly to the blocks. Although, the default number for this block is 50 and the first number entered is always compared with 50, by default.

“() < ()” Operator block

“() = ()” Operator block

This operator block is used to check if the first value entered is equal to the second value. It reports “true” if the first value entered is equal to the second value and if the first value entered is not equal to the second value, then it will report “false”. This block is also used to compare strings.

This block comes under the category of Boolean blocks and the values can be added directly to the blocks. Although, the default number for this block is 50 and the first number entered is always compared with 50, by default.

“() = ()” Operator block

“() and ()” Operator block

This operator block joins two Boolean blocks and if both the blocks are true, then it returns “true” and if any one of the blocks is false, then it returns “false”. This block comes under the category of Boolean blocks and the values can be added directly to the blocks.

“() and ()” Operator block

“() or ()” Operator block

This operator block joins two Boolean blocks and if both the blocks are true or any one of the blocks is also true, then it returns “true” and if both the blocks are false, then it returns “false”.

This block comes under the category of Boolean blocks and the values can be added directly to the blocks.

“() or ()” Operator block

“not ()” Operator block

This operator block returns the opposite Boolean value of the input given. If the input is given as “true”, then it will return “false” and if the input is given as “false”, then it will return “true”.

This block comes under the category of Boolean blocks and the values can be added directly to the blocks.

“not ()” Operator block

“join () ()” Operator block

This operator block joins or links two values together that are given as input and then report the result. For example, if the two values given are “happy” and “morning”, then the final result will be “happymorning”.

This block comes under the category of reporter blocks and the values can be added directly to the blocks. Although, the default values for this block are apple and banana.

“join () ()” Operator block

“letter () of ()” Operator block

This operator block reports the specified characteristics of the given input. This lock is not only confined to letters, it will also report characters, numbers, and spaces.

This block comes under the category of reporter blocks and the values can be added directly to the blocks. Although, the default values for this block are 1 and apple.

“letter () of ()” Operator block

“length of ()” Operator block

This operator block reports the number of characters that a given string (input) contains.

This block comes under the category of reporter blocks and the values can be added directly to the blocks. Although, the default value for this block is apple.

“length of ()” Operator block

“() contains () ?” Operator block

This operator block is used to compare the first parameter’s text with the second parameter’s text. It compares and returns whether or not the first parameter’s text contains the second parameter’s text.

This block comes under the category of Boolean blocks and the values can be added directly to the blocks. Although, the default values for this block are apple and a.

“() contains () ?” Operator block

“() mod ()” Operator block

This operator block reports the remainder that is obtained when the first input is divided by the second input. 

This block comes under the category of reporter blocks and the values can be added directly to the blocks.

“() mod ()” Operator block

“round ()” Operator block

This operator block rounds the given input (number) to the nearest integer. If the given input is 0.5 or more than that, then the input will be rounded up and if the input is 0.5 or less than that, then the input will be rounded down.

This block comes under the category of reporter blocks and the values can be added directly to the blocks.

“round ()” Operator block

“() of ()” Operator block

This operator block is used to perform a specified function on a given input. The function can be chosen from the drop-down menu as per the requirement.

This block comes under the category of reporter blocks and the values can be added directly to the blocks.

“() of ()” Operator block
“() of ()” Operator block

How to use Operator blocks in Scratch?

Operator blocks in Scratch are one of the 9 categories of blocks available in the block palette. Operator blocks are used to compare variables and expressions given. To use this block, just click on the “Operators” button which is a green-colored circle available on the left side of the screen, and then all the blocks present under the operator block will appear, as shown below:

scratch editor

Different types of blocks in Scratch

  1. Motion Blocks
  2. Events Blocks
  3. Looks Blocks
  4. Sound Blocks
  5. Control Blocks
  6. Sensing Blocks
  7. Operator Blocks
  8. Variables Blocks
  9. My Blocks

Frequently asked questions (FAQs)

What is the operator block in Scratch?
Operator blocks are one of the 9 categories of blocks available in Scratch that are used to compare variables and expressions given as input.

How many total operator blocks are available in Scratch?
There are a total of 18 operator blocks in Scratch, out of which, 7 blocks are Boolean blocks and the rest 11 blocks are reporter blocks.

Which operator block is used to add two numbers in Scratch?
() + () operator block is used to add two numbers in a Scratch project.

Which block is grouped in orange color in Scratch?
In Scratch, the Control block is grouped in orange color.

What is the use of operator block?
The operator block in Scratch is used to

What is the Scratch mod operator block?
The mod operator block in Scratch is used to report the remainder that is obtained when the first input is divided by the second input. 

We hope you understand what Operator Blocks in Scratch are and how to use them. If you have any doubts, you can ask your doubts in the comment section and we will get back to you as soon as possible.

For further reading, read our top 10 Scratch games to create and play games on Scratch!

Get 1-on-1 online Scratch classes
Don't forget to share this post!
tutor Pic
tutor Pic

First Lesson Free

No Credit Card

No Subscription