Question:

When this code is executed, what will result be set to?

func fetchCrewMember() -> (job: String, name: String) {
    return ("Public Relations", "Jayne")
}

let result = fetchCrewMember().0

 

Correct answer: "Public Relations".

Explanation: Even though we name the elements in fetchCrewMember()'s tuple return value, those elements are still accessible using their numerical index as used in the code.


Keywords:

© 2017 QuizBucket.org