Math operators
Four basic operations, integer division, and remainder.
Syntax
+ - * div mod /
Description
Integer division is with div, and remainder with mod. / is only used with floating-point (Double) numbers (7.0/2.0).
Example
Loading editor…
Expected output
10 3 1 3.5
When to use?
Calculations, even/odd check (mod x 2 or even).
Common mistakes
- ⚠️ Do not use / with Int; perform integer operations with div/mod.