A tuple is a heterogeneous data structure, consisting of a fixed number of elements, each with a different data type. A tuple, however, can contain objects of different types, as well as being immutable. They are particularly useful when returning multiple values from methods.
A tuple's type is determined by how many elements it contains as well as the type of those elements. Scala uses Tuple2, Tuple3, etc., up to Tuple22, to represent types of tuples. Scala currently limits the number of elements in a tuple to 22, and if the number of elements in the tuple exceeds 22, an error will be generated.
Example: A tuple storing an integer, and a string.
val name = (23, "InterviewBit")
The inferred type of ingredient is (Integer, String), which is shorthand for Tuple2[Int, String].
Note: Tuples can be used to overcome this limit. It is possible for a tuple to contain other tuples.