Calculation is the determination of something by using mathematics. One can evaluate an expression on the Scratch Wiki using the parser function #expr. There is a 14 digit limit for rational and irrational digits; rational numbers will show up as scientific notation as it passes the 14th digit.


To use this function, simply use the syntax {{#expr:expression}}. For example, {{#expr:2+2}} is equal to 4, but {{#expr:5/0}} will result in an error (division by zero is undefined), similar to an error produced by the template {{error}}. This function also accepts wiki variables in it; {{#expr:{{CURRENTDAY}}^2}} is equal to 16. Common supported operators include -,+,*,/,^,brackets and common functions include sin( ), cos( ), tan( ), ln( ), abs( ), ceil( ), floor( ), mod( ). Irrational numbers are also supported, such as pi and e. Note the trigonometric functions are based in radians and not in degrees.


Note Note: In logic gate functions (not, and, or), 0 equals false, 1 equals true. Other values always equal true.
Operator Explanation Example
+ Adds two operands together or a unary operator {{#expr:5+5}} = 10
Five plus five is equal to ten.
{{#expr:+7}} = 7
(Positive) seven is equal to (positive) seven.
- Subtracts two operands or a unary operator {{#expr:10-3}} = 7
Ten minus three equals to seven.
{{#expr:+-8}} = -8
(Positive) negative eight is equal to negative eight.
* Multiplies two operands together {{#expr:2*9}} = 18
Two multiplied by nine equals to eighteen.
/ Divides two operands {{#expr:35/7}} = 5
Thirty-five divided by seven is equal to five.
^ Exponent, Multiplies the number x times {{#expr:4^3}} = 64
Four to the power of three is equal to sixty-four.
!= Inequality {{#expr:2!=6}} = 1
Two is unequal (True(1)) to six.
{{#expr:3+2^2!=7}} = 0
Two to the power of two (four) plus three (seven) is not unequal (False(0)) to seven.
= Equality {{#expr:(4-2)^2=4}} = 1
Four minus two (two) to the power of two (four) is equal (True(1)) to four.
{{#expr:9+3^2=144}} = 0
Three to the power of two (nine) plus nine (eighteen) is not equal (False(0)) to one hundred and forty-four.
> Greater than {{#expr:2>1}} = 1
Two is greater than (True(1)) one.
{{#expr:e>e}} = 0
The Euler number (2.71828...) is not greater than (False(0)) itself.
>= Greater than or equal to {{#expr:7>=7}} = 1
Seven is equal to (True(1)) seven.
{{#expr:2>=0}} = 1
Two is not greater than (False(0)) zero.
< Less than {{#expr:1<{{#expr:4/3}}}} = 1
One is less than (True(1)) four-thirds (1.333...).
{{#expr:abs-50<22}} = 0
The absolute value of negative fifty (fifty) is not less than (False(0)) twenty-two.
<= Less than or equal to {{#expr:9<=(8+({{#expr:1/3}}+{{#expr:2/3}}))}} = 1
Nine is equal to (True(1)) one third added to two thirds.
{{#expr:2<=1}} = 0
Two is not less than (False(0)) one.
abs Absolute value {{#expr:abs-6}} = 6
The absolute value of negative six is equal to (positive) six.
acos Inverse of cos function {{#expr:acos1}} = 0
The arccosine of one is zero.
{{#expr:acos(sqrt(2)/2)}} = 0.78539816339745
The arccosine of 2 halved is pi/4 (~0.785).
and Logical AND {{#expr:5 and 4}} = 1
True(5) and True(4) is equal to True(1).
{{#expr:0 and 0}} = 0
False(0) and False(0) is equal to False(0).
asin Inverse of sine function {{#expr:asin0}} = 0
The arcsine of zero is zero.
{{#expr:asin(0.5)}} = 0.5235987755983
The arcsine of one half is pi/6 (~0.524)
atan Inverse of tan function {{#expr:atan1}} = 0.78539816339745
The arctangent of one is pi/4 (~0.785).
{{#expr:atan(sqrt(3))}} = 1.0471975511966
The arctangent of 3 is pi/3 (~1.05).
ceil Raises the decimal to the next integer {{#expr:ceil-3.9}} = -3
The ceiling of negative three and nine tenths is equal to negative three.
cos Cosine function in radians {{#expr:cos0}} = 1
The cosine of zero radians is one.
{{#expr:cos(45*pi/180)}} = 0.70710678118655
The cosine of 45 degrees is 2/2 (~0.707).
div Same as division {{#expr:6 div 2}} = 3
Six divided by two is equal to three.
exp Irrational number e (euler number) to x power {{#expr:exp5}} = 148.41315910258
The Euler number to the power of five is about one hundred and forty-eight.
floor Lowers the decimal to the next integer {{#expr:floor-6.79}} = -7
The floor of negative six and seventy-nine hundredths is equal to negative seven.
ln Natural logarithm {{#expr:ln(e^5)}} = 5
The (natural) logarithm for e to the power of five is five.
{{#expr:ln pi/ln10}} = 0.49714987269413
The base ten (natural) algorithm for pi is about zero and five tenths.
mod Modulo, remainder {{#expr:19 mod 7}} = 5
The remainder of nineteen divided by seven is five.
not Logical NOT {{#expr:not 4}} = 0
Not True(4) is equal to False(0).
{{#expr:not 0}} = 1
Not False(0) is equal to True(1).
or Logical OR {{#expr:0 or 0}} = 0
False(0) or False(0) is equal to False(0).
{{#expr:0 or 5}} = 1
False(0) or True(5) is equal to True(1).
round Rounds the number to the xth digit after the decimal {{#expr:1.4757027 round 3}} = 1.476
One and four million, seven hundred fifty-seven thousand, twenty-seven ten-millionths rounded to the third digit after the decimal point is equal to one and four hundred seventy-six thousandths.
{{#expr:82978 round -2}} = 83000
Eighty-two thousand, nine hundred and seventy-eight rounded to the second digit before the decimal point is equal to eighty-three thousand.
sin Sine function in radians {{#expr:sin1}} = 0.8414709848079
The sine of one radian is about zero and eight tenths.
{{#expr:sin(30*pi/180)}} = 0.5
The sine of thirty degrees is equal to one half.
tan Tangent function in radians {{#expr:tan0}} = 0
The tangent of zero is zero.
{{#expr:tan(45*pi/180)}} = 1
The tangent of 45 degrees is equal to one.
trunc 'Truncates' x into an integer without rounding {{#expr:trunc-7.8}} = -7
Truncated negative seven and eight tenths is equal to negative seven.


  • {{#expr:(0or1)+1}} = 2
  • {{#expr:0or not1}} = 0
  • {{#expr:------5}} = 5
  • {{#expr:not not 1}} = 1
  • {{#expr:not0 or not0 and not1}} = 1
  • {{#expr:pi/pi and pi*pi/pi}} = 1
  • {{#expr:.}} = 0
  • {{#expr:.1}} = 0.1
  • {{#expr:e-6}} = -3.281718171541
  • {{#expr:1e-6}} = 1.0E-6


An error will result if:

  • An operator is missing a parameter.
    • {{#expr:2+}} gives Expression error: Missing operand for +.
  • There is an unexpected number or operator.
    • {{#expr:2 3}} gives Expression error: Unexpected number.
    • {{#expr:=}} gives Expression error: Unexpected = operator.
  • An unsupported word or character is used.
    • {{#expr:what}} gives Expression error: Unrecognized word "what".
    • {{#expr:%}} gives Expression error: Unrecognized punctuation character "%".
  • A mathematical error occurs.
    • {{#expr:1/0}} gives Division by zero.
    • {{#expr:ln-1}} gives Invalid argument for ln: <= 0.

If a number is too large, it returns INF (positive infinity) or -INF (negative infinity).

  • {{#expr:1e309}} gives INF
  • {{#expr:-1e309}} gives -INF

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.