An Enumerator
is an object that implements iteration in a controlled fashion.
Instead of looping until some condition is satisfied, the object enumerates values as needed. Execution of the loop is paused until the next value is requested by the owner of the object.
Enumerators make infinite streams of values possible.
Parameter | Details |
---|---|
yield | Responds to yield , which is aliased as << . Yielding to this object implements iteration. |