Arithmetic Operators

Syntax
ArithmeticExpression :
     Expression + Expression
   | Expression - Expression
   | Expression * Expression
   | Expression / Expression
   | Expression % Expression
   | Expression ** Expression
   | Expression & Expression
   | Expression | Expression
   | Expression ^ Expression
   | Expression << Expression
   | Expression >> Expression

Binary operators expressions are all written with infix notation. This table summarizes the behavior of arithmetic and logical binary operators on primitive types.

SymbolInteger
+Addition
-Subtraction
*Multiplication
/Division*
%Remainder
**Exponentiation
&Bitwise AND
|Bitwise OR
^Bitwise XOR
<<Left Shift
>>Right Shift

* Integer division rounds towards zero.

Here are examples of these operators being used.

3 + 6 == 9
6 - 3 == 3
2 * 3 == 6
6 / 3 == 2
5 % 4 == 1
2 ** 4 == 16
12 & 25 == 8
12 | 25 == 29
12 ^ 25 == 21
212 << 1 == 424
212 >> 1 == 106