Skip to content

Instantly share code, notes, and snippets.

@RickArora
Created March 1, 2019 02:51
Show Gist options
  • Save RickArora/24253ea360e63e2c89babd6d9bb7401b to your computer and use it in GitHub Desktop.
Save RickArora/24253ea360e63e2c89babd6d9bb7401b to your computer and use it in GitHub Desktop.
# Write a method, `only_vowels?(str)`, that accepts a string as an arg.
# The method should return true if the string contains only vowels.
# The method should return false otherwise.
def only_vowels?(vowels)
vowels.split.all? { |letter| "aeiou".include?(letter) }
end
p only_vowels?("aaoeee") # => true
p only_vowels?("iou") # => true
p only_vowels?("cat") # => false
p only_vowels?("over") # => false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment