From: Bertram Scharpf Date: 2007-10-19T05:04:44+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 In case you really need the array _and_ its reduced version you could do somthing like a = [1,2,3] (d = a.dup).pop d The dup is inevitable and would be part of a inverse_pop method if there were one. Therefore I strongly recommend you consider another time about what you want to achieve and how it is done best. No harm meant, Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de