Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyEnumerable and custom eachSingle-choice MCQ

A custom Enumerable yields an infinite sequence. What does this print?

class Naturals include Enumerable def each n = 1 loop { yield n; n += 1 } end end p Naturals.new.lazy.select(&:even?).first(3)