From: kjana@...4lab.to (YANAGAWA Kazuhisa) Date: 2001-10-16T20:49:14+09:00 Subject: [ruby-talk:22609] Re: Array.filter The answer was already posted so I just point a minor issue.... In message miles@puzl.pixar.com writes: > a = [1, 2, 3, 4] > b = a.filter { |i| i % 2 = 0 } > > leaving a = [1, 2, 3, 4] and b = [2, 4]. Array#filter does not behave such way. a = [1, 2, 3, 4] a.filter { |i| i%2 == 0 } #=> -:2: warning: Array#filter is deprecated; use Array#collect! p a #=> [false, true, false, true] as a warning message says, it is a destrcutive variant of Array#collect. -- kjana@dm4lab.to October 16, 2001 Whatever is worth doing at all is worth doing well.