xxxxxxxxxx
let setExample: Set = ["Apple", "Orange", "Banana", "Apple"]
if setExample.contains("Apple") {
print("Its healthy")
}
print(setExample)
// OUTPUT:
//Its healthy
//["Orange", "Apple", "Banana"]
xxxxxxxxxx
var ages = [1,2,3,4,4]
var agesSet = Set(ages)
agesSet.insert(101)
let truee = agesSet.contains(101)
print(agesSet, truee)
Sets have faster lookups
xxxxxxxxxx
// create a set of integer type
var studentID : Set = [112, 114, 116, 118, 115]
print("Student ID: \(studentID)")