Vidyalelo
Ruby Programming · Q5

Enumerators and Iterators in Ruby

Programming · Ruby Programming · question 5

Q5

How do you define a custom iterator in Ruby?

A.
By using the define_iterator keyword
B.
By extending the Iterator class
C.
By creating a method that yields to a block of code
Answer
D.
By invoking the create_iterator method

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board