What does this code print to the console?swiftvar userLocation: String = 'Home' { willSet(newValue) { print('About to set userLocation to \(newValue)...') } didSet { if userLocation != oldValue { print('userLocation updated with new value!') } else { print('userLocation already set to that value...') } } } userLocation = 'Work'

🎲 Try a Random Question  |  Total Questions in Quiz: 69  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Swift Programming Quiz — practice the complete quiz, review flashcards, or try a random question.

Swift Programming  MCQs For LinkedIn Skill Assessments.


What does this code print to the console?<br>swift<br>var userLocation: String = 'Home' {<br> willSet(newValue) {<br> print('About to set userLocation to \(newValue)...')<br> }<br> didSet {<br> if userLocation != oldValue {<br> print('userLocation updated with new value!')<br> } else {<br> print('userLocation already set to that value...')<br> }<br> }<br> }<br> userLocation = 'Work'<br>