0 votes
in Swift by
What is Tuple? How to create a Tuple in swift?

1 Answer

0 votes
by
A tuple is a group of different values in a single compound value. It is an ordered list of elements. There are two ways of accessing the object data in a tuple i.e. by name or by position.

In swift, a tuple can consist of multiple different types. It can support two values i.e. one of integer type, and the other of a string type. It is a legal command.

For Example: let ImplementationError = (501, “Not implemented”).

We can create a basic tuple like this:

let person = (name: “Ajay” , age: 34)

Related questions

0 votes
asked Nov 6, 2022 in Swift by rajeshsharma
0 votes
asked Nov 6, 2022 in Swift by rajeshsharma
...