Last active
November 2, 2022 00:11
-
-
Save lalizita/0d86d8ee0a27ba3c923918e3202c7e82 to your computer and use it in GitHub Desktop.
Sample anonymous function example with Golang for medium article
This file contains 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
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