Skip to content

Instantly share code, notes, and snippets.

@S0ngyuLi
Last active July 30, 2017 06:05
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 S0ngyuLi/87b64d24cf61506674c2748979291c0c to your computer and use it in GitHub Desktop.
Save S0ngyuLi/87b64d24cf61506674c2748979291c0c to your computer and use it in GitHub Desktop.
A Simple Tutorial on Callbacks
/*
Example 1
*/
func OkName(param1, param2, newStr, callback) {
callback(newStr)
}
OkName(1,2,"newStr", collectNewStr(param) {
store(param)
})
/*
Example 2
*/
func OkName(param1, param2, newStr) {
store(newStr)
}
func store(param) {
db.insert(param)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment