4 ms·
Yeah it's not intuitive, but there isn't really another way to do it, right? Every concrete iterator is specific to what it returns and what it iterates over.
by ReactiveJelly 6y ago
Yeah it's not intuitive, but there isn't really another way to do it, right? Every concrete iterator is specific to what it returns and what it iterates over.
I think it's documented under something like "How to implement Iterator" but if that's not where people will go looking when they need it, then it should be somewhere else.
- lostmsu 6y agoIn C# and Python you can write an iterator using `yield` keyword. E.g. for(i in array) yield i The language then transforms this into an implementation of the base iterator interface under the hood.