The range min and max methods return the first and last elements in an array: : Range Min Max « Range « Ruby






The range min and max methods return the first and last elements in an array:

range = "a".."e"        #creates "a", "b", "c", "d", "e"
puts range.min          #prints "a"
puts range.max          #prints "e"

 








Related examples in the same category

1.Get the min element in a range
2.Get the max element in a range