From: sto.mar@... Date: 2013-02-03T00:26:10+09:00 Subject: Re: Confusion with Enum#with_index Am 02.02.2013 13:27, schrieb Arup Rakshit: > I was playing to understand the method "Enum#with_index" with the below > code: > > =================================================== > irb(main):024:0> xs = ['a', 'b', 'c'] > => ["a", "b", "c"] > irb(main):025:0> xs.to_enum.with_index(2) > => #:with_index(2)> > > ==================================================== > > irb(main):014:0> to_three = Enumerator.new do |y| > irb(main):015:1* 3.times do |x| > irb(main):016:2* y< irb(main):017:2> end > irb(main):018:1> end > => #:each> > irb(main):027:0> to_three.with_index(2) > => # #:each>:with_ind > ex(2)> > > ==================================================== > > Couldn't understand the output of "to_three.with_index(2)" . > > Could anyone help me? "Couldn't understand..." is not a particularly clear way to ask a question. What did you expect? What puzzled you? The "output" is only the string representation of the enumerator object that you created. But you haven't "done" anything with it. --