Ruby/Array/reject
Материал из Wiki.crossplatform.ru
Версия от 18:01, 13 сентября 2010; ViGOur (Обсуждение | вклад)
reject the even ones
primes = [2,3,5,7] primes.reject {|x| x%2==0} # => [3,5,7]: reject the even ones
reject with block logic
a = ["a", "b", "c", "d", "e", "f", "g", "h"] p a.reject { |x| x < "e" } # => ["e", "f", "g", "h"]