divide

Modified on Thu, 9 Jul at 10:49 AM

divide

TABLE OF CONTENTS

Mathematical division

Definition

number divide(number $left, number $right)

Divides $left by $right.

Parameters

number $left

The number to be divided.

number$right

The number to divide by.

Returns

number

The quotient of $left and $right.

Examples

Transformation
{
  a: divide('4',`2`),
  b: divide('5',`2`),
  c: divide(`4.0`,`true`),
  d: divide(`4.0`,`2.0`),
  e: divide(`4`,`0`),       // Error
  f: divide(`4`,`null`)     // Error
}
Result
{
  "a": 2,
  "b": 2.5,
  "c": 4,
  "d": 2
}

Remarks

  • The returned number is always written as an integer if the result is an integer, even if both $left and $right are floats.
  • Division by zero returns an error.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article