Answers for "how to get the minimum value from an array in ruby"

0

ruby get min value from array

people = {'joe' => 21, 'bill' => 35, 'sally' => 24}

people.min_by { |name, age| age } #=> ["joe", 21]
people.max_by { |name, age| age } #=> ["bill", 35]
Posted by: Guest on October-18-2020

Code answers related to "how to get the minimum value from an array in ruby"

Browse Popular Code Answers by Language