Check if 2 strings are equal

 Problem

I have two strings and want to check if they are equal (if it's the same string).



 Recipe


// String literals
let s1 = "Hello World"
let s2 = "Hello Guys"
 
// Check they are the same

if s1==s2 {
    print("S1 is the same as S2")
}
else {
    print("S1 is not the same as S2")
}
				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground