Modulus Operator

MOC Programming

Created: 2022-07-04
Tags: #fleeting


Plainly, it just gives you the remainder of the division of two numbers.

7 % 3 =  1
6 % 3 = 0

See if it's an even number
n % 2
1 means odd
0 means even

Circular Array
[1, 2, 3, 4]
Since the array is full,
I can wrap back at the beginning
and that's where I put the new values 5, 6
[5, 6, 3, 4]