Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. def count_number_of_vowels (str)
  2.  
  3. string = str.downcase
  4. count = string.scan(/[aeoui]/).count
  5.  
  6. if count == 1
  7. return "This string has #{count} vowel"
  8. else
  9. return "This string has #{count} vowels"
  10. end
  11.  
  12. end
  13.  
  14. count_number_of_vowels ("hello world")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement