[Solved] Why is the else part of my if else statement is not executing?


if true condition is always satisfied. You should modify your userInput() method to return a boolean value, if you want to use it.

func userInput() -> Bool {
    return Util.shared.isPalindrome(word: word)
}

And then handle the result:

if userInput() { 
    // do something 
} else { 
    // do something else 
} 

solved Why is the else part of my if else statement is not executing?