Skip to content

Commit

Permalink
Add 2 new questions (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
GordonGrant authored Aug 6, 2020
1 parent c6c1478 commit 8249692
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions swift/swift-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,34 @@ class LSN : MMM {
- LSN
- There is no base class.
- This code is invalid.

#### Q38. What does this code print to the console?

```swift
var 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"
```

- About to set userLocation to Work… userLocation updated to new value!
- About to set userLocation to Work… userLocation already set to that value…
- About to set userLocation to Home… userLocation updated to new value!
- ERROR

#### Q39. What must a convenience initializer call?
- a base class convenience initializer
- either a designated or another convenience initializer
- a designated initializer
- none of these answers

0 comments on commit 8249692

Please sign in to comment.