Skip to content

Instantly share code, notes, and snippets.

@fenixbrassi
Last active December 31, 2015 19:29
Show Gist options
  • Save fenixbrassi/8033869 to your computer and use it in GitHub Desktop.
Save fenixbrassi/8033869 to your computer and use it in GitHub Desktop.
String practice
#strings practice
def longest_strings( param , n )
param.split(' ').sort_by(&:length).reverse.first(3)
end
puts "Give me the string"
words = gets.chomp
puts "\n"
puts "The 3 longest string are: #{ longest_strings(words,3)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment