Math operators
Try it yourself →Basic arithmetic, integer division, remainder, and exponentiation.
Syntax
+ - * / div(a,b) % ^
Description
/ always returns a float (7/2=3.5). Integer division is done with div(a,b). % gives the remainder, ^ gives the power (not **).
Example
println(7 + 3) println(7 / 2) println(div(7, 2)) println(7 % 2) println(2 ^ 10)
Expected output
10 3.5 3 1 1024
When to use?
Calculations, even/odd checks (x % 2).
Common mistakes
- ⚠️ Power is with ^, not **; integer division is div(a,b).