From: Daniel Sheppard Date: 2005-10-28T14:51:25+09:00 Subject: Re: difference between the each iterator and the collect iterator? It's the return value of those two methods [1,2,3,4].each { |x| x + 5 } will return [1,2,3,4] [1,2,3,4].each { |x| x + 5 } will return [6,7,8,9] > -----Original Message----- > From: vasten@gmail.com [mailto:vasten@gmail.com] > Sent: Friday, 28 October 2005 1:17 PM > To: ruby-talk ML > Subject: difference between the each iterator and the collect > iterator? > > Hi: > I am a newbie as far as Ruby is concerned. I was going > through the programming ruby book (2nd Edition), but was not > able to figure out the difference between the 2 statements: > > [1, 2, 3, 4].collect{[i] puts i } > and > [1, 2, 3, 4].each{|i| puts i } > > Can some guru in this group shed some light? > > Thanks. > > > > ##################################################################################### This email has been scanned by MailMarshal, an email content filter. #####################################################################################