abs()
Gives the absolute (unsigned) value of a number.
Syntax
abs(number)
Description
Makes it positive if negative, leaves it unchanged if positive. Works on integers and floats.
Returns
The absolute value of the number.
Example
Loading editor…
Expected output
7 3.5
When to use?
Measuring the difference between two values without a sign (e.g. |target - actual|).