7 ms·
Yeah, I was meaning 'for loops' to include the modern sense of foreach loops too. Java doesn't distinguish and Kotlin doesn't have the old style at all. There'
by mike_hearn 10y ago
Yeah, I was meaning 'for loops' to include the modern sense of foreach loops too. Java doesn't distinguish and Kotlin doesn't have the old style at all.
There's no rule that says a for loop must only support a single iteration interface. That seems more like an implementation detail of the compiler than a problem with for loops in general.
- willtim 10y agoOf course the big elephant in the room that I didn't mention, is that for loops get work done via mutation. This is perhaps what was mean't by “unclean".