To add to this, you are already very familiar with modulo cycles in daily life.
as the total number of seconds increases, tick = secondCount%60 gives the current second tick, which is always a number 0-59.
as the days roll by, dayOfTheWeek = dayCount%7 gives the current day of the week, which is always a number between 0-6 (days 1-7).
no matter how many 8-slice pizzas you ordered for the event, and no matter how many slices were eaten, slice = sliceCount%8 will tell you the slice situation (0-7). If slice is 0 that means the last pizza is done and the next pizza is whole and untouched.
no matter how many 100-sheet boxes of tissue you bought, sheet = sheetCount%100 is how far through the current box you are. If sheet = 90 it is almost time for a new box.
Answers
Usually you use it when you have a certain number of things you want to cycle through, and at the end of the cycle, you go back to the beginning.
Here is a sketch that displays a color at a time. There are five colors it can display. When you click, you go to the next color.
What happens when you get to the color after the last color? There is no color after the last color, so it goes back to the first one.
It's also the remainder you get when you divide.
To add to this, you are already very familiar with modulo cycles in daily life.
as the total number of seconds increases,
tick = secondCount%60
gives the current second tick, which is always a number 0-59.as the days roll by,
dayOfTheWeek = dayCount%7
gives the current day of the week, which is always a number between 0-6 (days 1-7).no matter how many 8-slice pizzas you ordered for the event, and no matter how many slices were eaten,
slice = sliceCount%8
will tell you the slice situation (0-7). If slice is 0 that means the last pizza is done and the next pizza is whole and untouched.no matter how many 100-sheet boxes of tissue you bought,
sheet = sheetCount%100
is how far through the current box you are. If sheet = 90 it is almost time for a new box.