What is the myth behind this line of code 2%7 = 2

hi house, can someone explain to me the mysteries behind the line of code:
x % y = x;
where x > y;
for example, 2 % 10 = 2.
what is happening there?

that’s the reminder operator
2 divided by 10 is 0 with a reminder of 2
the reminder operator gives the reminder of the division operation

1 Like

wow…thank you just open my eye
you cant believe, it has been given me headache for a while, have gone out mathematics, am thinking there is a logical algorithm behind it…thanks

Believe it’s remainder.

Usually not a spelling police but you know the saying…

Coding is like writing a book, except if you leave out a comma on page 531 the whole thing makes no damn sense.

1 Like