reject the even ones : reject « Array « Ruby






reject the even ones


primes = [2,3,5,7]
primes.reject {|x| x%2==0}  # => [3,5,7]: reject the even ones

 

Related examples in the same category

1.reject with block logic