Skip to content

Instantly share code, notes, and snippets.

@patrickjahns
Created January 2, 2021 12:41
Show Gist options
  • Save patrickjahns/645d0ae29fbe093f0f38ca3afda86184 to your computer and use it in GitHub Desktop.
Save patrickjahns/645d0ae29fbe093f0f38ca3afda86184 to your computer and use it in GitHub Desktop.
# A
## A1
func mutate(in *integer) {
in + 1
}
## A2
func mutate(int integer) int {
return i+1
}
This is mostly in line with functional programming right?
# B
type struct foo {
value int
}
## B1
func(f foo) mutate() foo {
f.value + 1
return f
}
## B2
func(f *foo) mutate() {
f.value+1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment