0
So, im a c# guy, and cant seem to figure out what "%" means in Javascript and c++?
would be helpful..
2 Antworten
+ 3
It's the modulo operator: https://en.m.wikipedia.org/wiki/Modulo_operation
Basically, a%b subtracts from a the largest multiple of b without getting a negative number and then takes the remainder
5%4 = 5-4*1 = 1
9%4 = 9-4*2 = 1
12%4 = 12-4*3 = 0
...and so on. One can observe that by using the modulo operator one will always get a value lower than b.
0
Great answer, thank you!