On Tuesday 19 June 2007 11:48, memsom wrote: > > '?' indeed! I am fascinated! What does yield do exactly... > > presumably it returns a result from the function without closing > > down that instance of the function? Amazing concept. > > I suspect - given the word "DOS" in some of the code, it allows a DOS > event loop to continue in a single threaded co-operative multitasking > environment.
Nope. It's that what Mark thinks, and more like (Python's) generator thingie (link posted by Luca): -- 8< -- Some high level languages support iterators in exactly this fashion. For example Metaware's Professional Pascal Compiler for the PC supports iterators[14]. Were you to create a code sequence as follows: iterator OneToFour:integer; begin yield 1; yield 2; yield 3; yield 4; end; and call it in the main program as follows: for i in OneToFour do writeln(i); -- 8< -- -- Found in: http://www.oopweb.com/Assembly/Documents/ArtOfAssembly/ Volume/Chapter_12/CH12-6.html Regards, Vinzent. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal