Modulo
Modulo is a mathematical operation that returns the remainder of a division of two arguments. It is available in every programming language.
Syntax
The remainder is what is left over after dividing the first argument, the dividend, by the second, the divisor or modulus:
remainder = dividend % divisor
Most programming languages use the %
symbol to represent the modulo operation, though some may use mod
or other variations.
Examples
The following is an example of the modulo operator in Python:
All contributors
- garanews222 total contributions
- StevenSwiniarski474 total contributions
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.