This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MyStruct { | |
var value: Int = 0 | |
} | |
var instanceOfMyStruct = MyStruct(value: 42) | |
var assignedInstance1 = instanceOfMyStruct | |
assignedInstance1.value = 2 // Change the copied instance | |
instanceOfMyStruct.value // 42: Original is unchanged |
NewerOlder