Question:

What output will be produced by the code below?

var crew = ["Captain": "Malcolm", "Doctor": "Simon"]
crew = [:]
print(crew.count)

Correct answer: 0.

Explanation: [:] is shorthand syntax for "an empty dictionary", which causes the crew dictionary to be wiped.

 


Keywords:

© 2017 QuizBucket.org