mod
Gives the remainder of a division, with the sign of the dividend (mod(7, 3) is 1; mod(-7, 3) is -1; mod(7.5, 2) is 1.5). Division by zero gives null.
Runs on: either side: the compiler places the statement that calls it where the values it uses live.
Format:
mod(number, divisor)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| number | number | the dividend |
| divisor | number | the divisor |
Returned Value:
| Type | Description |
|---|---|
| number | the remainder, or null |
Examples
is_even = (mod(n, 2) == 0)