Lots of people don't know of % works. Just as a lot of C / Java / C# programmers do not know the difference between "if a() & b()" and "if a() && b()".
Note that I'm not saying it's great to use "if a() & b()". All I'm saying is most people do not know the difference.
Try it if you interview people. It's fascinating. And, no, I'm not disqualifying people if they don't know the difference ; )
Lots of people don't know of % works. Just as a lot of C / Java / C# programmers do not know the difference between "if a() & b()" and "if a() && b()"
Funny you say that. And incredibly sad too.
I have participated in interviewing many junior/mid/senior developers and you are correct that they trip up on the % operator. I've also experienced them tripping up on the word "modulo" and instead trying to calculate the remainder of a division operation by hand.
While not trying to be elitist, I'm not sure what it says about our industry when a fundamental concept such as modulus is not understood by programmers.
That reminds me of a co-worker who was weirded out by my using "modulo" to mean "except for" or "ignoring" (which is, to my understanding, perfectly ordinary English).
They did, thankfully, fully understand it in a mathematical context - to my knowledge I've never worked with someone who didn't, although this and nearby comments are leaving me wondering...
I've occasionally tried to work out a sensible rationale for the non-mathematical meaning based on the mathematical one. Perhaps this is etymologically unsound, but hey, words are fun. But how do you get from "remainder when divided by" to "except"? I guess `x % y` gives you "the leftovers," which is close enough to "except."
Lots of people don't know of % works. Just as a lot of C / Java / C# programmers do not know the difference between "if a() & b()" and "if a() && b()".
Note that I'm not saying it's great to use "if a() & b()". All I'm saying is most people do not know the difference.
Try it if you interview people. It's fascinating. And, no, I'm not disqualifying people if they don't know the difference ; )