From: Martin DeMello Date: 2005-02-08T13:35:07+09:00 Subject: Re: iteration the ruby way Robert Klemme wrote: > > Note though that you might as well treat the *first* element specially. > IMHO that's usually easier even with #each: > > first = true > enum.each do |e| > if first > first = false > else > print " -- " > end > print e > end > print "\n" Though I hate doing this, because that 'if', that you know is going to be useless after the first time, is nonetheless run for every subsequent element. I guess in terms of actually running time it's negligible, but it still feels ugly. martin