Contact Free trial Login

mod

mod(Number, Number): Number

Returns the modulo (the remainder after performing dividing the dividend by the divisor).

Parameters

Name Description

dividend

The number that serves as the dividend for the operation.

divisor

The number that serves as the divisor for the operation.

Example

This example returns the modulo of the input values. Note that you can also use the mod(dividend, divisor) notation (for example, mod(3, 2) to return 1).

Source

%dw 2.0
output application/json
---
{
  "a" : 3 mod 2,
  "b" : 4 mod 2,
  "c" : 2.2 mod 2
}

Output

{
  "a": 1,
  "b": 0,
  "c": 0.2
}