From: "Y. NOBUOKA" Date: 2011-03-22T20:14:34+09:00 Subject: Re: Difference between for and someclass.each do |var| Hi, >> for var in class.each do >> #stuff >> end >> >> class.each do |var| >> #stuff >> end > > it is just syntatical sugar. Both are essentially equal. > The only difference is that each is a method of an Enumerable. In a for/in loop, you need not call #each method. I think following two code snippets are mostly equal. # the #each method call isn't needed for var in obj do # stuff end # mostly equivalent to the previous snippet obj.each do |var| # stuff end Note: A #each method returns a Enumerator object if you don't provide a block. ~$ irb ruby-1.9.2-p136 :001 > [].each # provide no block => # ruby-1.9.2-p136 :002 > [].each {} # provide a block => [] Regards, -- NOBUOKA Yu