Is it a value in the hash : has_value « Hash « Ruby






Is it a value in the hash


hash = {}
1.upto(10) { |x| hash[x] = x * x }
hash.has_value? 49                   # => true
hash.has_value? 81                   # => true
hash.has_value? 50                   # => false

 








Related examples in the same category

1.see if it has a given value with value? or has_value?: