Last active
April 24, 2024 16:07
-
-
Save codedeman/6fa779d9ba6dcd76f5dea233c28b6909 to your computer and use it in GitHub Desktop.
Struct
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 Point { | |
let x: Double | |
let y: Double | |
} | |
var point1 = Point(x: 10, y: 20) | |
var point2 = point1 // Creates a copy of point1 | |
point2.x = 30 // Modifying point2 doesn't affect point1 | |
print(point1.x) // Output: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment