Arithmetic ( + - * / % ** )
Four basic operations, modulo, and exponentiation.
Syntax
a + b, a % b, a ** b
Description
Standard operators. ** is exponent, % is modulo. Integer division returns an integer: 7 / 2 = 3.
Example
Loading editor…
Expected output
1 1024 3 3.5
When to use?
Calculations; watch out for /: decimals are dropped in integer division.
Common mistakes
- ⚠️ 7 / 2 → 3 (integer division). For decimals, write 7.0 / 2.