# mod() Function & Examples

Use the mod() operators function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## mod

#### x % y

#### x mod y

#### mod(x, y)

Try it yourself:

```calculio
7 % 3
11 % 2
10 mod 4
isOdd(x) = x % 2
isOdd(2)
isOdd(3)
```

[divide](https://calcul.io/function/divide/index.md)

---

## Compute a mathematical modulus

**mod(a, b)** returns the remainder-like value of a modulo b operation. It is useful for cycles, wrapping indexes, clock arithmetic, and periodic patterns.

## Example

`mod(17, 5)` is 2. Use [rem](https://calcul.io/function/rem/index.md) when the remainder convention for signed values is what you need; the two can differ for negative inputs. [floor](https://calcul.io/function/floor/index.md) helps explain the mathematical definition.

## Caveats

The divisor must not be zero. Be explicit about negative-value conventions in indexing code, and use [round](https://calcul.io/function/round/index.md) only if input values must first become integers. For cyclic angles, combine mod with [pi](https://calcul.io/function/pi/index.md) carefully.

[All functions](https://calcul.io/functions/index.md)
