I like the example in the comment better. It is more confusing as to what is going on to an experienced dev like me. iSeven is always odd tho right?
Comment on I wish
TopRamenBinLaden@sh.itjust.works 7 months agoI like the example in the post better. It is more clear as to what is going on to an experienced dev like me. What’s this 2 percent nonsense?
Clearwatermo@lemmy.world 7 months ago
TopRamenBinLaden@sh.itjust.works 7 months ago
I think you are on to something there. Personally, I just don’t see the advantage of using iSeven over iSix, though. I might start using iEight whenever they finally iron the kinks out of that one.
filcuk@lemmy.zip 7 months ago
Readability over obscure hacks
rustbuckett@lemmings.world 7 months ago
It’s not obscure. This is the example, with syntactic differences, for this problem in almost every programming book I’ve read. He just didn’t include newlines.
mob@lemmy.world 7 months ago
At this point, I really can’t tell who’s joking around or who’s being serious in this thread.
Shits cracking me up though reading this all as serious discussion.
TopRamenBinLaden@sh.itjust.works 7 months ago
Hey now, this is a serious academic conversation about the 2 percent operator.
EvokerKing@lemmy.world 7 months ago
Explanation: the percent is modulus. Basically it’s just divide the first number by the second and return the remainder. If you do number % 2, it will return 1 if it is odd and 0 if it is even. For example 4/2 has a remainder of 0 and therefore is even. 3/2 has a remainder of 1, and therefore is odd.
TopRamenBinLaden@sh.itjust.works 7 months ago
Sorry I should’ve put the /s. I was just playing. But thank you for the helpful explanation, nonetheless.