Ruby/Array/max
Материал из Wiki.crossplatform.ru
Версия от 18:01, 13 сентября 2010; ViGOur (Обсуждение | вклад)
Get the max value in an array
[3, 5, 11, 16].max # => 16 ["three", "five", "eleven", "sixteen"].max # => "three" ["three", "five", "eleven", "sixteen"].max { |x,y| x.size <=> y.size } # => "sixteen"