Abs Procedure
Returns the absolute value of the number.
If the input number
x is positive, then it is returned unchanged.
If the input number
x is negative, then it is multiplied by -1 to produce a positive number.
Declaration
function Abs(x as Number) as Number
Parameters
- x as Number — Positive or negative number.
Return value
Number — Positive number.
Example
Code
print Abs(5)
print Abs(-5)
Output