What does this print?
struct Box {
var w = 5
var area: Int { w * w }
}
let b = Box()
print(b.area)
Try it in the online Swift Playground →
[spoiler title="Solution"]
Answer:
25
Explanation:
Computed properties calculate their value each time they’re accessed, rather than storing it.
[/spoiler]