The absolute
function returns the absolute value of a number. The absolute value of a number is the distance of the number from zero, regardless of whether the number is positive or negative.
Syntax
absolute(number)
Parameters
number
: The number for which you want to find the absolute value.
Examples
In the following examples, the absolute
function is used to find the absolute value of various numbers.
absolute(-5) = 5
absolute(3) = 3
absolute(0) = 0
Notes
- The
number
parameter must be a number (integer or float). - The
absolute
function returns a number. - If the
number
parameter is positive, the function will return the same number. If thenumber
parameter is negative, the function will return the absolute value of that number (i.e., the positive version of the number).