Mega Code Archive

 
Categories / Ruby / Array
 

Max_by with block

langs = %w[java perl python ruby]    # Which has the longest name? langs.max_by {|word| word.length }   # => "python": Ruby 1.9 only