From: Bertram Scharpf Date: 2007-10-19T20:01:48+09:00 Subject: Re: array help Hi, Am Freitag, 19. Okt 2007, 04:05:55 +0900 schrieb JeremyWoertink@gmail.com: > 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 Here's another one, just for entertainment: class Array ; def evth_but_pop ; slice 0, length-1 ; end ; end [1,2,3].evth_but_pop Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de