I have a hash:
hash_example = {777 =>[dog,brown,3], 123=>[cat,orange,2]}
I want to go through the hash array value and determine based on the third element which pet is the oldest age. I would choose the max
for my method, the part where I figure out which value is associated with max
and returning it to the screen is the part I am not getting, or am I completly lost? I threw the third value in there for educational purpose on how to compare different elements of the array.
b = hash_example.values.max{|k,b,c| b<=>c }
print b