Answers for "math.max in ruby"

0

max and ruby

# Ruby program for max method in Enumerable
# Initialize 
enu1 = (2..6)
# Prints
puts enu1.max 
p enu1.max(2)
# unless you were searching for the children TV series...
Posted by: Guest on July-29-2021
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

Browse Popular Code Answers by Language