On Wednesday 20 June 2007 06:55, Mark Wood wrote: [iterator functions with yield()] > It strikes me that whilst it may not be the best programming form, > the same thing could be done readily with a global variable?
Not if you call such an iterator several times at once (in nested loops for example): |for i in LoopStep (1, 10, 1) ... | for j in LoopStep (2, 20, 3) ... Correct me, if I'm wrong, but AFAICS each function retains its own set of local variables and thus return "sets". This would be very hard to accomplish with global variables. Regards, Vinzent. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal