Delete elements from a set with block
require 'set' primes = Set[2, 3, 5, 7] # set of prime numbers primes.delete_if {|x| x%2==1} # => #<Set: {2}>: remove odds primes.delete_if {|x| x%2==1} # => #<Set: {2}>: unchanged