3 ms·
I think you could write something using the experimental Rangefunc feature that does that.
by dgunay 3y ago
I think you could write something using the experimental Rangefunc feature that does that.
- icholy 3y agoYou can, which makes me wonder why they added the range-over-int functionality when it could have been a function in the proposed iter package: for x := range iter.N(10) { ... }
- dgunay 3y agoBetter yet, you can name it something like `iter.ZeroTo(10)` and it immediately clears up questions about whether it begins from 0 or 1.
- maximus-decimus 3y agoMy guess because it really doesn't save that many characters compared to for i:= 3 ; i<10; i++ {} I didn't count but it might actually be longer. range 10 is at least shorter