Skip to content
Open menu

Scratch & Flowcharts

Scratch Operators Code Blocks

Updated 8 November 2026 1 min read

Scratch Operators

Scratch operators represent mathematical and logical statements, so your program can calculate results. You will find the Operators blocks in Scratch by clicking the green circle shown below.

Get codes

Here is what each Operators block does.

Scratch Operators

basic arithmetical operators

These blocks do arithmetic on numbers and variables. You can place them inside other blocks, and inside each other, to build longer expressions.

This block picks a random number from a user defined range

This block picks a random number from a range you choose.

comparison operators

These blocks test for equivalence or relative value (equal, greater than, or less than). They can be used with Control blocks to make logic tests. After doing the comparison these code blocks output either TRUE or FALSE.

logic operators

The AND, OR and NOT blocks make logical tests, usually inside a Control block. Each one outputs TRUE or FALSE depending on its inputs.

contains operator

This block checks whether a character appears in a string. It outputs TRUE if it does and FALSE if it does not.

String operators

These blocks work on “strings” of text, and can also be used with numbers. JOIN combines two strings into one. LETTER OF gives the character at a position. LENGTH OF counts the characters in a string.

mod operator

The “modulo” function reports the remainder of a division operation.

round operator

The “round” function helps to round off the values by removing decimal digits.

other mathematical operators

This block gives other mathematical functions you may need.
Example: finding the square root of a number

Scratch script that tests an example condition

Examples to Practice Scratch Operators

Find the account balance after a withdrawal

find account balance using scratch operators

Check the length of a password and say whether it is strong enough.

check password length

Video recording

Practise with real papers

Have ICT notes or papers from your school? Share them and help other students.

Submit a Paper