What does this print?
struct Point {
var x: Int
var y: Int
}
var a = Point(x: 3, y: 5)
var b = a
b.x = 9
print(a.x)
print(b.x)
Try it in the online Swift Playground →
[spoiler title="Solution"]
Answer:
3 9
Explanation:
Structs are value types, so b gets an independent copy of a.
[/spoiler]