3 ms·
> Also, the fact that programming languages have any sort of remainder operator might not come up in a typical web dev coding bootcamp or a self-taught programm
by Cyberdog 5y ago
> Also, the fact that programming languages have any sort of remainder operator might not come up in a typical web dev coding bootcamp or a self-taught programmer's education.
That may be true, but as a web dev, I use the modulo quite frequently. Just yesterday I used it to implement some code where the client wanted to insert ads after every sixth paragraph in a page body, but not if there would be two paragraphs or less left on the page after the last ad. I can't imagine what kind of goofy hackneyed solution I would have ended up with if I didn't know about `%`.
Before CSS had :even and :odd pseudoselectors, we also commonly used it to zebra stripe tables.
Web dev isn't typically as math-y as, say, game dev, but I'd encourage anyone getting into it to at least learn the modulo beyond basic algebra stuff.
- phendrenad2 5y agoI've had to use it too - mostly when faffing about and not using some jQuery builtin. But to say that someone who doesn't know this easily-stackoverflowed ("how do I do something every nth array item") lacks basic programming ability ("why can't programmers program" is I think the original fizzbuzz blog post title) is I think going too far.