Arithmetic ( + - * / % )
Four basic operations and remainder.
Syntax
a + b, a % b
Description
Integer division truncates the decimal: 7 / 2 = 3. Different types cannot be added directly.
Example
Loading editor…
Expected output
1 3 3.5
When to use?
Calculations.
Common mistakes
- ⚠️ 7 / 2 = 3. Use 7.0 / 2.0 for decimals.