3 ms·
That’s probably okay if the code is I/O bound anyway, but in Go it will run a lot slower than doing multiple steps within a single for loop. For loops may be u
by skybrian 5y ago
That’s probably okay if the code is I/O bound anyway, but in Go it will run a lot slower than doing multiple steps within a single for loop.
For loops may be unfashionable but they aren’t hard to read.
- duped 5y agoI don't find iterator combinations hard to read. Especially with postfix methods. I do find deeply nested for loops with outer variables that might start uninitialized or need to be mutable much more difficult to read.
- skybrian 5y agoSometimes moving an inner for loop to a separate function (that will likely be inlined) is better to explicitly show its inputs and outputs.