Math & Text
mod
$mod
Remainder that is never negative for a positive divisor.
Syntax
$mod[a;b]
Parameters
| Parameter | Description |
|---|---|
a |
Dividend (integer). |
b |
Divisor (integer, not 0). |
Return Value
- string.
Usage
$mod[-3;8] → "5"
$mod[19;8] → "3"
Example
$setUserVar[cell;$mod[$getUserVar[x];8]]
Notes
JavaScript: bc.math.mod(a, b). $modulo keeps the sign of the dividend ($modulo[-3;8] is -3); $mod pairs with $floorDiv (a = $floorDiv*b + $mod).
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.