Skip to content

Instantly share code, notes, and snippets.

@FrancisGX
Created February 27, 2014 18:08
Show Gist options
  • Save FrancisGX/9255523 to your computer and use it in GitHub Desktop.
Save FrancisGX/9255523 to your computer and use it in GitHub Desktop.
def words
File.open('/usr/share/dict/words').to_a.map { |word| word.chomp }
end
def count
puts "There are this many words in the dicshonary #{words.length}"
end
def search
count
puts "Type something yolo."
input = gets.chomp.downcase
result = words.keep_if { |word| word.include?(input) }
puts "There are no words that match you search, jk #{result.length}"
print result
end
search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment