Ruby Language Enumerators

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

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.

Parameters

ParameterDetails
yieldResponds to yield, which is aliased as <<. Yielding to this object implements iteration.


Got any Ruby Language Question?