Contact Us 1-800-596-4880

mod

mod(dividend: Number, divisor: 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]