Add

The simple function to add two numbers.

Syntax

number add(number $left, number $right)

Adds two comma-separated numbers – not strings.

Parameters

$left: The first number.
$right: The second number.

Example

{
    "x": 2,
    "y": 3
}
{
    sum: add(x, y)
}
{
    "sum": 5
}

In this example, the keys “x” and “y” are added to form a new key “sum”. Notice that the values of the keys are all numbers.

Notes

Decimal separator

Decimal separator is a dot, and not a comma as in some regions of the world. i.e. “5.8” rather than “5,8”.