Skip to main content

abs

Function abs 

Source
pub fn abs(x: number) -> number
Expand description

Returns the absolute value of a number (integer/float).

§Parameters

  • x: a number.

§Return value

The maximum value between x and −x. The subtype of the result matches the subtype of the argument.

§Examples

print(math.abs(-5))      --> 5
print(math.abs(-5.25))   --> 5.25
print(math.abs(7))       --> 7