Arithmetic Operators
Operator | Description | Example | Result |
---|---|---|---|
+ (unary) | Returns a | +5 | 5 |
+ | Adds two numeric expressions | 4 + 1 | 5 |
- (unary) | Negates the numeric expression | -5 | -5 |
- | Subtract two numeric expressions | 4 - 1 | 3 |
* | Multiplies two numeric expressions | 4 * 1 | 4 |
/ | Divides one numeric expression (a ) by another (b ) | 4 / 2 | 2 |
% | Computes the modulo of numeric expression | 4 % 2 | 0 |