Hacker News new | ask | show | jobs
by selcuka 699 days ago
> I don't use n%x==0 a lot in real coding

I use it all the time, especially when logging the progress of a long running process at every x records.

1 comments

True, I use it there as well -- and then often wish afterwards that I had done a more expensive call to get the current time to print every X seconds instead of after an arbitrary number of records. Combining the two (with a fairly low %x) is probably the right answer