Swift – Initialize a Tuple
To initialize a Tuple with values in Swift, assign the comma separated values enclosed in parenthesis to a tuple variable.
The syntax to initialize a tuple is
(value1, value2, ..., valueN)
Values can be of different datatypes.
In the following program, we initialize a Tuple
x with values, and print it to console.
var x = ("Hello", 35, true) print(x)
("Hello", 35, true) Program ended with exit code: 0
In this Swift Tutorial, we have learned how to initialize a Tuple with values in Swift programming.