Operators blocks
Operators do maths, compare values, combine logic, and manipulate text. They are all reporters or booleans, so they plug into the slots of other blocks rather than standing on their own.
Maths
( )+( ),-,*,/are addition, subtraction, multiplication, and division.- pick random
1to10returns a random number in the range. If both inputs are whole numbers it returns an integer, otherwise a decimal. ( )mod( )returns the remainder (using floored division, so the result matches the sign of the divisor).- round
( )rounds to the nearest whole number. abs/floor/ceiling/sqrt/sin/cos/tan/asin/acos/atan/ln/log/e ^/10 ^of( )applies a maths function chosen from the menu.
Comparison and logic
( )<( ),( )=( ),( )>( )compare two values.< >and< >,< >or< >combine two booleans.- not
< >inverts a boolean.
Text
- join
applebananajoins two values into one string. - letter
1ofapplereturns a single character by position. - length of
applereturns the number of characters. applecontainsa? reports whether the text contains a substring (case-insensitive).
Bilup and TurboWarp extras
These operators are not in stock Scratch:
- letters
1to3ofapplereturns a substring between two positions. iteminapple(index_of) returns the position of a substring, or 0 if not found (case-insensitive).- replace
awith-inapplereplaces every occurrence of a substring (case-insensitive). abrepeated3times repeats a string a number of times.upper/lowercase ofApplechanges the case of text.- trim
appleremoves leading and trailing whitespace. - clamp
5between0and10limits a number to a range. - min of
( )and( )/ max of( )and( )return the smaller or larger value (these accept more than two operands). - pi reports the constant 3.14159..., handy for circle maths.
- newline reports a line-break character, for building multi-line strings.
See Bilup extras for the full list.