Previous: Generator class-instance creation, Up: Generator


1.82.2 Generator: stream protocol

atEnd
Answer whether more data can be generated.


next
Evaluate the generator until it generates the next value or decides that nothing else can be generated.


peek
Evaluate the generator until it generates the next value or decides that nothing else can be generated, and save the value so that #peek or #next will return it again.


peekFor: anObject
Evaluate the generator until it generates the next value or decides that nothing else can be generated, and if it is not equal to anObject, save the value so that #peek or #next will return it again.


yield: anObject
When entering from the generator the code in the block is executed and control flow goes back to the consumer. When entering from the consumer, the code after the continuation is executed, which resumes execution of the generator block.