Home Modulo Operation
Post
Cancel

Modulo Operation

Modulo Operation

Finding the remainder of one number divided by another

A modulo operation guarantees that the index is in a valid range as long as the specific operation is repeated. A simple example of a modular operation is time: time has a repeating cycle of 12 hours, so 8:00 and 20:00 are the same 8:00.

When you use a modular operation in programming, it guarantees that the amount of shifting is within the valid range of what you are searching for, such as searching for characters in a string.

This post is licensed under CC BY 4.0 by the author.