From: E S Date: 2005-02-05T10:45:29+09:00 Subject: Re: iteration the ruby way > > L�hett�j�: "William James" > Aihe: Re: iteration the ruby way > > > E S wrote: > > > ary[0..-1].each {|e| do_something(e) } > > do_something_else(ary.last) > > Shouldn't that be > > ary[0...-1].each {|e| do_something(e) } > do_something_else(ary.last) > > or > > ary[0..-2].each {|e| do_something(e) } > do_something_else(ary.last) > > ? Yes, or indeed, it was actually supposed to be ary[0...-1] :) In either case, as expected, the #inject-solution was superior. E