Ruby | Hash class >= method
Hash#>=() is a Hash class method which compares two Hash values.
Syntax: Hash.>=()
Parameter: Hash values
Return: true – if a >= b otherwise return false
Example #1 :
# Ruby code for Hash.>=() method # declaring Hash value a = {a:100, b:200} # declaring Hash value b = {a:100, c:300, b:200} # declaring Hash value c = {a:100} # COMPARING TWO Hash VALUES puts "Hash a >= b : #{a>=b}\n\n" # b puts "Hash b >= c : #{b>=c}\n\n" # c puts "Hash a >= c : #{c>=a}\n\n" |
chevron_right
filter_none
Output :
Hash a >= b : false Hash b >= c : true Hash a >= c : false
Example #2 :
# Ruby code for Hash.>=() method # declaring Hash value a = { "a" => 100, "b" => 200 } # declaring Hash value b = {"a" => 100} # declaring Hash value c = {"a" => 100, "c" => 300, "b" => 200} # COMPARING TWO Hash VALUES puts "Hash a >= b : #{a>=b}\n\n" # b puts "Hash b >= c : #{b>=c}\n\n" # c puts "Hash a >= c : #{c>=a}\n\n" |
chevron_right
filter_none
Output :
Hash a >= b : true Hash b >= c : false Hash a >= c : true
Recommended Posts:
- Ruby | Hash class <= method
- Ruby | Hash Class
- Ruby | BigDecimal class hash value
- Ruby | Array class hash() function
- Ruby | Hash > method
- Ruby | Hash value? method
- Ruby | Hash < method
- Ruby | Hash to_hash method
- Ruby | Hash replace() method
- Ruby | Hash values_at method
- Ruby | Hash shift() method
- Ruby | Hash select() method
- Ruby | Hash to_h method
- Ruby | Hash to_a method
- Ruby | Hash store() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



