Skip to content

Instantly share code, notes, and snippets.

@Catfish-Man
Created September 1, 2018 19:14
Show Gist options
  • Save Catfish-Man/e4887ba3cd6f681a574c22d741c49808 to your computer and use it in GitHub Desktop.
Save Catfish-Man/e4887ba3cd6f681a574c22d741c49808 to your computer and use it in GitHub Desktop.
func g(_ x: inout Int) {
x = x * x
}
func f() {
var computed:Int {
get { return 5 }
set { print(newValue) }
}
g(&computed)
}
f() //prints 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment