Skip to content

Instantly share code, notes, and snippets.

@omochi
Created September 4, 2018 06:43
Show Gist options
  • Save omochi/b31f4916fda78e9a2e804c4b2233370d to your computer and use it in GitHub Desktop.
Save omochi/b31f4916fda78e9a2e804c4b2233370d to your computer and use it in GitHub Desktop.
struct Stone {
var x: Int {
get {
return 1
}
_modify {
var x: Int = 3
yield &x
y = x
}
}
var y: Int = 0
}
func mod(_ x: inout Int) {
x = 8
}
func main() {
var a = Stone()
mod(&a.x)
print(a.y)
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment