Math.abs
Math.abs
Function
Absolute value. Returns the absolute value of value.
Syntax
Math.abs(value)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| value | Number | Yes | None | The number involved in the calculation. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns the absolute value of value. An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.abs(-5) // Output: 5 print result
Notes
- Parameters are converted to f64 according to BT relaxed number rules.