Skip to content
Blog

Numeric operators

Numeric operators are used to perform operations on numeric data types.

OperatorDescriptionExampleResult
+Addition2 + 3.55.5
-Subtraction4.5 - 22.5
*Multiplication3.2 * 26.4
/Division9 / 51
%Modulo (remainder)9 % 54
^Power4 ^ 51024.0

Appropriate types are cast wherever possible. For example, in 9 / 5, the result is 1 because both operands are integers. In 9.0 / 5, the result is 1.8 because one of the operands is a float.