Math operators
Four basic operations, integer division, and remainder.
Syntax
+ - * / ~/ %
Description
/ always returns a decimal (double). Use ~/ for integer division. % gives the remainder (commonly used in even/odd checks).
Example
Loading editor…
Expected output
10 3.5 3 1
When to use?
Calculations, even/odd check (number % 2).
Common mistakes
- ⚠️ / returns a decimal; use ~/ if you want an integer result.