Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 4
tolowercased is actually a function and you can't compare those two functions like that.
You have to actually call them with parenthesis.
fixed code:
let s1 = "We are alike"
let s2 = "We are Alike"
if s1 == s2 {
print("These two strings are equal")
}
else if s1.lowercased() == s2.lowercased(){
print("these two strings are similar")
}
else{
print("these are two different strings")}