[fpc-pascal] Metaware

Vinzent Hoefler JeLlyFish.software at gmx.net
Wed Jun 20 10:26:58 CEST 2007

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.



More information about the fpc-pascal mailing list