Created
January 2, 2021 12:41
-
-
Save patrickjahns/645d0ae29fbe093f0f38ca3afda86184 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# 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