The simple function to divide one number by another number.


number divide(number $left, number $right)

Divides $left by $right. Must be numbers and not strings.


$left: The numerator.
$right: The denominator.


    "x": 12,
    "y": 3
    result: divide(x, y)
    "result": 4

In this example, the key “x” is divided by the key “y” to form a new key “result” i.e. 12 divided by 3 equals 4. Notice that the values of the keys are all numbers.


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”.

Dividing by zero

If the $right value (aka the denominator) of the function evaluates to zero, the function will give an error: “Can not divide by 0”.