- "Green Blocks" redirects here. For the extension blocks which are also green, see Extension.
Operators is one of the ten categories of Scratch blocks. They are color-coded light-green, and are used to script math equations and string handling. It was previously titled Numbers Blocks, but was renamed in Scratch 1.4 due to new blocks that handled strings.
There are currently 18 Operators blocks: 7 Boolean blocks and 11 Reporter blocks. Along with the Translate Extension, Makey Makey Extension, and Go Direct Force & Acceleration Extension, this category does not contain any Stack blocks.
|Note:||Click on a block to learn more about it.|
Scratch 3.0 has the following 7 Operators Boolean and 11 Operator Reporter blocks:
(() + ())
(() - ())
(() * ())
(() / ())
(pick random (1) to (10))
(join [apple] [banana])
(letter (1) of [apple])
(length of [apple])
(() mod ())
([abs v] of ())
Prior to Scratch 1.2, the () of () block was two separate blocks, abs () and sqrt (), with none of the other options being available.
Scratchers have suggested an Operators block that solves exponents.
(() ^ ():: operators)
Some Scratchers have suggested true and false Booleans, however this has not been implemented, possibly due to the easy workaround. Here is a sample of what such blocks might look like:
Instead, there is a workaround that is usually mentioned. However, setting a variable to "true" or "false" will not have the same effect as a boolean. For example, a variable set to "true" will not equal 1.
set [variable v] to [true] set [variable v] to [false]
Another workaround consists of using empty operators blocks:
<not <>> //Returns true <<> and <>> //Returns false
() + () • () - () • () * () • () / () • Pick Random () to () • () < () • () = () • () > () • () and () • () or () • Not () • Join ()() • Letter () of () • Length of () • () Mod () • Round () • () of ()More blocks...