this code works
extension Character {
func isVowel() -> Bool {
switch self {
case "a", "e", "i", "o", "u", "A", "E", "I", "O", "U":
return true
default:
return false
}
}
}
but when I use an if statement it gives "cannot convert type "String" to Bool
extension Character {
func isVowel() -> Bool {
if "a", "e", "i", "o", "u" {
return true
} else {
return false
}
}
}//does not work
I have tried adding "self" and self.asciiValue
how to properly convert the switch statement into if statement? sorry, still a beginner lol