Last active
March 7, 2021 00:59
-
-
Save marlonjames71/cd5901baae7930b9caad9e77eb6c5f1c to your computer and use it in GitHub Desktop.
Number Of Vowels Code Challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func numberOfVowels(in string: String) -> Int { | |
var count = 0 | |
for char in string.lowercased() { | |
switch char { | |
case "a", "e", "i", "o", "u": | |
count += 1 | |
default: | |
() | |
} | |
} | |
return count | |
} | |
numberOfVowels(in: "The quick brown fox jumps over the lazy dog") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment