Skip to content

Instantly share code, notes, and snippets.

@marlonjames71
Last active March 7, 2021 00:59
Show Gist options
  • Save marlonjames71/cd5901baae7930b9caad9e77eb6c5f1c to your computer and use it in GitHub Desktop.
Save marlonjames71/cd5901baae7930b9caad9e77eb6c5f1c to your computer and use it in GitHub Desktop.
Number Of Vowels Code Challenge
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