-
Notifications
You must be signed in to change notification settings - Fork 1
Operators
The following are the supported operators that can be used in expressions.
Be aware the type of the expression is defined by the type of the operands. string will win over everything and float will win over ints.
-
parentheses ()
They are used to prioritize the calculations -
sum +
Adds two values. In case one or both of the values is a string, then it works as concatenation of the values (that are converted to strings) -
subtraction -
Subtract two values. Does not work on strings. -
multiplication *
Multiplies two values. Does not work on strings. -
divide /
Divides two values. Does not work on strings and fails if the second operand is zero. -
modulo %
Gives back the modulo of the two values, the modulo is the remainder of the division. Does not work on strings. -
and &
Computes the binaryandof the two values. Does not work on strings and floats. -
or |
Computes the binaryorof the two values. Does not work on strings and floats. -
xor ^
Computes the binaryxorof the two values. Does not work on strings and floats. -
unary negation -
Used to change the sign of an int or a float -
binary negation !
transforms 0 in -1 and whatever is not 0 to 0 -
inversion ~
Produces the one complement of the value. Does not work on strings and floats.
TODO