Skip to content

Instantly share code, notes, and snippets.

@lalizita
Last active November 2, 2022 00:11
Show Gist options
  • Save lalizita/0d86d8ee0a27ba3c923918e3202c7e82 to your computer and use it in GitHub Desktop.
Save lalizita/0d86d8ee0a27ba3c923918e3202c7e82 to your computer and use it in GitHub Desktop.
Sample anonymous function example with Golang for medium article
func main() {
sayHi := func() {
fmt.Println("HIIIIIII!")
}
sayHi()
var sayBye func(name string)
sayBye = func(n string) {
fmt.Printf("Bye %s", n)
}
sayBye("Maria")
}
// OUTPUT
// HIIIIIII!
// Bye Maria
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment