We can compare two tuple values if they have the** same number of values** and belong to **same type**. Tuples are used to group multiple values in a single notation. Tuples are compared from left to right, one value at a time until there is a mismatch.If the values are not equal, the entire tuple becomes unequal. If all the values are matched, then the tuples are equal. Swift standard library includes tuple comparison operators for fewer than** seven elements**.

1 2 3 4 5 6 7 8 9 |
//Swift: Operator and Operands //Swift: Tuple comparison var x = ("Apple", "Orange", 45) var y = ("apple", "Orange" , 45) var z = ("Apple", "Orange", 45) print("The tuple values of x and z are equal: \(x == z)") print("The value of tuple x is less than value of tuple y: \(x < y)") print("The value of tuple x is less than value of tuple y: \(y > z)") |