$divide

$divide operator lets you divide one value from another and return the result of the expression. You can use this in any Expression Object.

Syntax

{
    "$divide": [<val_1>, <val_2>]
}

Properties

Returns

float - The result of $divide operation

Examples

Basic example

{
    "$divide": [10, 2]
}

The above expression returns 5.0

With Nested Expressions

{
    "$divide": [
        {
            "$add": [1, 2]
        },
        4
    ]
}

The above expression calculates the nested expression, return 3 in its place and then the outer $divide expression returns 0.75 overall.

With Magical Autocomplete

Let's say we have declared a variable temp in our API flow, which has a value of 6 currently.

{
    "$divide": ["$.variables.temp", 3]
}

The above expression would resolve to a result of 2.0

Last updated