abs()

Returns the absolute value of the passed value argument. That means, if a positive number or zero is passed, then the same number is returned. If however a negative number is passed, then the signment of the number is flipped to positive. So it behaves like simply removing the minus sign if any.

Function Prototype

abs(??number??)

Arguments

Argument Name Data Type Description
??number?? Integer Number The number to convert.
[required]

Return Value

Description Data Type
Absolute value of the passed number. Integer Number

Examples

on init declare %values[7] := ( -3, -2, -1, 0, 1, 2, 3 ) declare $i := 0 while ($i < num_elements(values)) message("The absolute value of " & $values[$i] & " is " & abs($values[$i])) end while end on