The Math folder in Blockly is supposed to be useful for performing mathematical operations. It contains blocks for basic arithmetic operations (+, -, *, /), as well as more advanced operations such as trigonometry, exponents, and logarithms.

The Math folder also contains blocks for working with variables, functions, and conditional statements. This allows you to write complex mathematical expressions in Blockly.

The description of this page will be particularly summarized because it will contain mostly mathematical elements and numbers to use in the other functions described.


The first block identifies a general number. It is also the most used one to program Misty because when you need to specify an action, like how many meters to drive, you will need to use this block to give the number.

The second block (π), returns the common constants: π (3.141...), e (2.718...), Φ (1.618...)

sqrt(2) (1.414...), or ∞ (infinity).

The third block (sin 45), returns the trigonometry functions (sin, cos, tan, asin, acos, atan) in degrees, not radians.

The difference between the black and the blue box for a number is that the blue one is bound to that expression, instead the black one is not.

The fourth block (square root 9), returns some common mathematical functions (square root, absolute, negative, ln, log10, e^, 10^).


With this block, you can do several operations like +,-,*,/,^ between two numbers.


This block checks if a number is even, odd, prime, whole, positive, negative, or divisible by (it depends on what the user clicks) and returns true or false.

Other operations

It is really intuitive to understand what these blocks do in Blockly:

  • The first block rounds up or down the number;

  • The second block constrains a number between a chosen range;

  • The third block returns the remainder of a division;

  • The fourth block generates a random fraction;

  • The fifth block generates a random integer in a range and is often used to create random sequences of lights with the misty RGB chest LED.

Change variable

With this block, you can select a variable in your code and change it according to the number written in the blue box.

Lists operations

This block is associated with a list of items that can return a sum, a minimum, a maximum, average, median, modes, standard deviation and a random item. So all the common statistic operations that you can do. This can be helpful in developing a program for Misty where you can extract a random name from a list or so.

Last updated