Syntax
remainder = expr
{ mod | %
} modulus
Description
The mod operator subtracts from abs(expr)
the largest multiple of abs(modulus
) which is less than or equal to abs(expr)
, and returns the result as remainder. If expr is negative, then a negative result is returned in remainder.
Note that if expr and modulus are both integers, the result of mod is just the remainder of the integer division operation expr / modulus.
See also
Appendix D - Numeric Expressions