Programming in Swift: Fundamentals

Oct 19 2021 Swift 5.5, iOS 15, Xcode 13

Part 2: Beginning Collections

11. Tuples

Lesson Complete

Play Next Lesson
Save for later
About this episode
See versions

See forum comments
Cinema mode Mark as Complete Download course materials
Previous episode: 10. Introduction Next episode: 12. Challenge: Tuples

Update Notes: The student materials have been reviewed and are updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a Professional subscription.

So far, you’ve been working with single pieces of data like an Integer or a String.

let studentMark: 
let studentMark: (String, Int)
let studentMark: (String, Int) = ("Chris", 49)
//                  0      1
let studentMark: (String, Int) = ("Chris", 49)
let studentData = (name: "Chris", mark: 49, petName: "Mango")
let theName = // gives you the name of the student
let theMark = studentData.mark // gives you the mark of the student
let thePetName = studentData.petName /// gives you the name of the student's pet
let (name, mark, pet) = studentData
let (name, �_, pet) = studentData