From: Thomas Adam Date: 2007-10-19T04:17:14+09:00 Subject: Re: array help Hi -- On 18/10/2007, JeremyWoertink@gmail.com wrote: > I have [1,2,3] and I want to return [1,2] is there already a method > that does this? > > irb(main):001:0> [1,2,3] > => [1, 2, 3] > irb(main):002:0> [1,2,3].pop > => 3 > irb(main):003:0> [1,2,3].everything_but_the_one_thing_that_pop_returns [1,2,3][0..-2] #=> [1, 2] -- Thomas Adam