On 2016-06-22 18:18, Dennis Poon wrote: > can we do it in descending order without a user defined enumerator?
Not as far as I know - I believe it is a one directional iterator (or so the interface suggests). There are tons of limitations with the for..in construct. Years back I implemented an iterator interface (based on Java definition of iterators) with multiple implementations for various container classes I use often. I can iterate forward, backwards, use a regex to filter (skip) what gets iterated etc. And using the factory method I can request an iterator instance with ease, and even register more iterators if needed. So much more flexible [personal opinion]. I've written an article about it some years back: http://geldenhuys.co.uk/articles/ Look for the “Iterator Pattern” article and sample code. Regards, Graeme _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal