From: Neil Stevens Date: 2005-02-28T07:30:08+09:00 Subject: Re: for vs. each On Sun, 27 Feb 2005 11:23:27 +0000, Fear Dubh wrote: > Hello, > > Is there a difference between: > for foo in bar do ... > and > bar.each do |foo| ... > > or is it just a question of style? > I prefer the look of "for ... do ...", > > but I mostly see each in the samples posted by the Ruby > wizards on the NG. I use 'each' because I never learned the 'for', but I think I'll probably start using for now that I've been reminded of it. The less punctuation I have to use, the better. It's easier to type, easier to read, and more descriptive of what it's doing. I just hope I remember to use it in the future! -- Neil Stevens - neil@hakubi.us 'A republic, if you can keep it.' -- Benjamin Franklin