minmax_by with block : minmax_by « Range « Ruby






minmax_by with block

(1..100).minmax_by {|n| n.to_s }  # => [1,99]  min, max as strings

 

Related examples in the same category