Skip to content

Instantly share code, notes, and snippets.

@codedeman
Last active April 24, 2024 16:07
Show Gist options
  • Save codedeman/6fa779d9ba6dcd76f5dea233c28b6909 to your computer and use it in GitHub Desktop.
Save codedeman/6fa779d9ba6dcd76f5dea233c28b6909 to your computer and use it in GitHub Desktop.
Struct
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