---
updatedAt: 2025-05-20T20:27:59.000Z
agentTools:
  projectIndex: https://docs.documotor.com/llms.txt
---

# abs

Find the absolute value of the argument

# Definition

`number abs(number $value)`

If `$value` is a number, returns the absolute value of the argument, equal to `$value` if `$value` is greater or equal to zero, and `-$value` if `$value` is less or equal to zero.

# Parameters

<Glossary>number</Glossary> `$value`

Number to calculate the absolute value of.

# Returns

<Glossary>number</Glossary>

A number greater or equal to zero, the absolute value of `$value`.

# Examples

```text Transformation
{
  negativeNum: abs(`-1`),
  positiveNum: abs(`2`),
  stringNum: abs('3.0'),
  truth: abs(`true`),
  falsity: abs(`false`),
  none: abs(`null`),
  text: abs(`"text"`),     // Error
  array: abs(`[]`),        // Error
  object: abs(`{}`)        // Error
}
```

```json Result
{
  "negativeNum": 1,
  "positiveNum": 2,
  "stringNum": 3.0,
  "truth": 1.0,
  "falsity": 0.0,
  "none": 0.0
}
```

# Remarks

Accepts Boolean, `null ` and strings with correct number format arguments as well, in which case the argument is converted to number implicitly before calculating the absolute value. Other argument types raise an <Glossary>Error</Glossary> and return `null`.