Sets
Set stores unique values with fast membership. Use union, intersection and subtracting.
Example
let a: Set = [1, 2, 3]
let b: Set = [3, 4]
print(a.union(b).sorted())
print(a.intersection(b))
print(a.subtracting(b).sorted())
print(a.contains(2))Exercise
Common items.
a.(b)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.