Skip to content

Instantly share code, notes, and snippets.

@lalizita
Created November 2, 2022 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lalizita/6c335d96f036a160801afab30104f666 to your computer and use it in GitHub Desktop.
Save lalizita/6c335d96f036a160801afab30104f666 to your computer and use it in GitHub Desktop.
Example of anonymous function with Go for a medium article
func main() {
n := func() int {
return 2
}
x := sumNumber(n())
fmt.Println(x)
}
func sumNumber(number int) int {
number++
return number
}
// OUTPUT
// 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment