From: Jimmy Thrasher Date: 2001-10-16T02:50:35+09:00 Subject: [ruby-talk:22582] Re: Array.filter Miles, > Where is the nondestructive Array.filter? I know that the old Array.filter has > been deprecated but I don't see a function that gives me this: > > a = [1, 2, 3, 4] > b = a.filter { |i| i % 2 = 0 } > > leaving a = [1, 2, 3, 4] and b = [2, 4]. Try Array#select. irb(main):001:0> a = [1,2,3,4] [1, 2, 3, 4] irb(main):002:0> b = a.select { |i| i % 2 == 0 } [2, 4] Jimmy