Arithmetic operators
The arithmetic operators are:
-
*
(multiplication) -
/
(division) -
+
(addition) -
-
(subtraction)
Infix *
,/
,+
,-
can be applied to all numeric (integer and double) operands, with an implicit upcast to double if any double is involved.
The operator +
(plus) also performs string concatenation with an implicit upcast to string if any string is involved.
The operator -
(minus) also exists in its monadic version, which simply inverts the signum of a numeric value.
Division by 0 always fails, causing the program to abort.
Operations associate to the left, except that multiplication and division operators have higher precedence than addition and subtraction operators. Precedence can be altered with parentheses.