Contact Free trial Login

abs

abs(Number): Number

Returns the absolute value of an input number.

Parameters

Name Description

number

The number to apply the operation to.

Example

This example returns the absolute value of the input numbers.

Source

%dw 2.0
output application/json
---
{
  a: abs(-2),
  b: abs(2.5),
  c: abs(-3.4),
  d: abs(3)
}

Output

{
  "a": 2,
  "b": 2.5,
  "c": 3.4,
  "d": 3
}

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub