Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

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]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ruby #min #array
ADD COMMENT
Topic
Name
2+9 =