Created
October 25, 2017 04:56
-
-
Save lamarmarshall/fdaff3f42b3201d60892dd7736ff1319 to your computer and use it in GitHub Desktop.
go callback, function as argument
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
package main | |
import "fmt" | |
func addName(name string, callback func(string)) { | |
callback(name) | |
} | |
func main() { | |
addName("lamar", func(nm string) { | |
fmt.Printf("hi may name is %v \n", nm) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment