Skip to content

Instantly share code, notes, and snippets.

@generalzhou
Created April 22, 2013 20:29
Show Gist options
  • Save generalzhou/5438256 to your computer and use it in GitHub Desktop.
Save generalzhou/5438256 to your computer and use it in GitHub Desktop.
puts "Type a word:"
list = []
while true
input = gets.chomp
break if input == ""
list << input
puts "Type another word (or press enter to finish):"
end
puts "Congratulations! Your dictionary has #{list.length} words:"
list_sorted = list.sort do |a, b|
a.upcase <=> b.upcase
end
puts list_sorted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment