Hi. I am currently following Apple's swift course. However, I get an error saying "Expected '}' at end of brace statement" and I don't really understand why ? Can someone explain why and eventually correct the code ? Thanks !
var question2 = question
let lowerQuestion2 = question.lowercased()
"hello" == "Hello"
func responseTo(question: String) -> String {
if question.hasPrefix("hello") {
if lowerQuestion2.hasPrefix("hello") {
return "Hello there"
} else {
return "That really depends"
}
}
Even if I haven't found a solution to the error, the code itself was wrong. Here's the solution.
var question = "HELLO"
let lowerQuestion = question.lowercased()
func responseTo(question: String) -> String {
if lowerQuestion.hasPrefix("hello") {
return "Hello there"
} else {
return "That really depends"
}
}