.contains()
var names: Set = ["Rosa", "Doug", "Waldo"]
print(names.contains("Lola")) // print: false
if names.contains("Waldo"){
print("There's Waldo!")
} else {
print("Where's Waldo?")
}
// print: There's Waldo!
Comments
var names: Set = ["Rosa", "Doug", "Waldo"]
print(names.contains("Lola")) // print: false
if names.contains("Waldo"){
print("There's Waldo!")
} else {
print("Where's Waldo?")
}
// print: There's Waldo!