Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created October 25, 2017 04:56
Show Gist options
  • Save lamarmarshall/fdaff3f42b3201d60892dd7736ff1319 to your computer and use it in GitHub Desktop.
Save lamarmarshall/fdaff3f42b3201d60892dd7736ff1319 to your computer and use it in GitHub Desktop.
go callback, function as argument
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