To be able to manipulate variables, you need to put them in various expressions involving more or less complex operations or functions.

We are going to talk about the most common operations from the Math folder here.

Number operationsEdit

Arithmetic operationsEdit

They are the addition, [plus], the substraction, [minus], the multiplication, [multiplied by], and the division, [divided by].

Don't forget that multiplications and divisions are done before additions and substractions. You can use the parentheses [(] and [)] to prioritize operations.

Negative, absolute value and signEdit

[negative] gives the opposite of a number, while [absolute value] (found in the sub-folder Functions) returns the value of a number without its sign, namely [absolute value] [nbr: x] is x if it is positive (or zero) and -x if it is negative (or zero).

You can look at the sign of a number with [sign] (also found in Functions), [sign] [nbr: x] will return:

  • 1 \quad\;\; \mathrm{if\ }x>0
  • 0 \quad\;\; \mathrm{if\ }x=0
  • -1 \quad\! \mathrm{if\ }x<0

[negative] [7] returns -7, [absolute value] [7] returns 7, [sign] [7] returns 1, and [negative] [-3.1] returns 3.1, [absolute value] [-3.1] returns 3.1, [sign] [-3.1] returns -1.


[nbr: x] [to the power of] [nbr: y] returns x^y.

  • If y is a positive integer, that means it returns x\times x\times \cdots \times x with y times the factor x, in the same way that x\times y returns x+x+\cdots +x with y times the term x.
  • If y is 0, it always returns 1, which is the multiplicative identity (it is what remains if you decide to multiply x by itself "zero time").
  • If y is a negative integer, it returns 1/x/x/\cdots /x with |y| (the absolute value of y) times the factor x, which is also \frac{1}{x^{|y|}}.
  • If y is not an integer, it gets more complicated. See exponentiation.

Floor, ceiling, roundEdit

A number x can be rounded down with [floor] [nbr: x], rounded up with [ceiling] [nbr: x], and rounded to the nearest integer with [round] [nbr: x] (note: if the fractional part of x is 0.5, it is rounded up).

[floor] [1.84] returns 1, [ceiling] [1.84] returns 2, [round] [1.84] returns 2 and [floor] [-2.12] returns -3, [ceiling] [-2.12] returns -2, [round] [-2.12] returns -2.

Modulo and integer divisionEdit

When we have two non-negative integers a and b, with b\neq 0, we can perform a division a/b. This returns a number c with the following property: b\times c = a.

The problem is that c is usually not an integer, because b doesn't evenly divides a. For instance, 7/3 is not an integer.

However, there is an integer just below a/b (it's the floor of a/b), let's call it q the quotient, and it verifies b\times q \leq a < b\times (q+1), which implies that 0 \leq a - b\times q < b. The number a - b\times q is an integer called the remainder, noted r. This is the proof that you can write a as b\times q + r with 0 \leq r < b, that is called an Euclidean division (we can show that the integers q and r are actually unique, but we won't do it here).

In our example where a=7 and b=3, we have 3\times 2 \leq 7 < 3\times 3 and therefore q=2. Indeed, we can see that 7/3 = 2 + 1/3 and 2 is the integer part of 7/3.

There is no tile that gives the quotient directly (although one could use the floor of the float division). However, we can get the remainder with the [modulo] tile. [nbr: a] [modulo] [nbr: b] returns the remainder in the Euclidien division of a by b. Then, since a = b\times q + r, we can get the quotient using the formula q = \frac{a - r}{b}.


You can clamp a number between two values with [clamp] and its modifiers [min] and (max].

Text operationsEdit


You can "add" two texts with [plus]: this is called concatenation.

Example: ["Hello "] [plus] ["World!"] returns "Hello World!".

It is not possible to "remove" part of a text, [minus] is NOT available for texts.

Boolean operationsEdit


[not] [bool: condition] returns the "opposite" of the condition, this is to say false if the condition is true and true if the condition is false.

And, orEdit

[bool: condition1] [and] [bool: condition2] returns true if both conditions are true, and false otherwise, while [bool: condition1] [or] [bool: condition2] returns true if at least one of two conditions is true, and false otherwise.

Note that [and] and [or] can only be used as a boolean operator, they CANNOT be used to specify several actions or modifiers, or get multiple objects together (see object set addition below for that).

Equal to, not equal toEdit

You can interpret [equal to] for booleans as a way to test if both booleans are true or false at the same time.

Similarly, you can check if either one of the booleans is true and not the other with [not equal to]: this is sometimes called the exclusive or ("xor" for short).

Object set operationsEdit

Addition, substraction, intersectionEdit

You can add objects (and object sets) together, giving you a bigger object set that contain all the objects that you have put in the expression (or that were in the object sets).

You can also substract objects/object sets from an object set, which gives you a smaller object set with all objects that were not from the objects/object sets you substracted.

[intersect] is not in the Math folder, but in the Compare folder. The intersection of two object sets is a new set containing the objects that were in both sets.


An object set \mathcal{S} contains a number of objects [obj set: S] [count]. Note that the count is 0 for an empty object set.

Vector operationsEdit

You can look at Vector Math for detailed explanations about vectors/points and the operations you can use on them. Here, we give a brief overview of the main operations on vectors (not points).

Addition of vectorsEdit

You can add (or substract) vectors, which consists in adding (or substracting) them componentwise:
(x, y, z) + (x', y', z') = (x+x', y+y', z+z').

Multiplication of a vector by a numberEdit

You can multiply a vector by a number k, this results in a new vector with the same direction if k is positive or with the opposite direction if k is negative, and a new magnitude ("length") of the absolute value of k times the original magnitude. For a vector (x, y, z), we have: k\times (x, y, z) = (k\times x, k \times y, k \times z)

Example: [east] [multiplied by] [-2] is the vector (-2, 0, 0) of direction west and magnitude 2.


The magnitude of a vector \vec{v} is given by [vec: v] [length].

The formula for a vector (x, y, z) is the following (according to the Pythagorean theorem):
\Vert (x, y, z) \Vert = \sqrt{x^2 + y^2 + z^2}
See Distance between two points for more details.


[vec: v] [normal] returns the direction of the vector \vec{v}, this is to say the vector of magnitude 1 which has the same direction as \vec{v}. A vector of magnitude 1 is called a normal vector or unit vector.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.