2 ms·
> 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.
by selcuka 2y 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.
- lucb1e 2y agoTrue, 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