Contact Free trial Login

mod

mod(Number, Number): Number

Returns the modulo (the remainder after 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
---
[ (3 mod 2), (4 mod 2), (2.2 mod 2) ]

Output

[ 1, 0, 0.2]

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.