Subtract

Can be used to subtract two numbers.

Syntax

number subtract(number $left, number $right)

Subtracts $right from $left.

Parameters

$left: The first number. Can be of type number (integer/float) and string.
$right: The second number. Can be of type number (integer/float) and string.

Example

In the example below, two key-value pairs, each containing a number value, are used in combination with the subtract function.

{
    "x": 5,
    "y": 3
}
{
    sub: subtract(x, y)
}
{
    "sub": 2
}

Notes

Numbers vs. strings

Even though string parameters works, it is recommended to use numbers (integers or floats) since strings are more error prone.

Decimal separator in floats

The decimal separator in floats is a dot and not a comma as in some regions of the world. i.e. 5.8 rather than 5,8.