result â value
Instance Public methods
Returns the return value of the iterator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | o = Object . new def o. each yield 1 yield 2 yield 3 100 end e = o.to_enum puts e. next #=> 1 puts e. next #=> 2 puts e. next #=> 3 begin e. next rescue StopIteration => ex puts ex.result #=> 100 end |
Please login to continue.