learn go function callback
2015-11-22 18:04
357 查看
package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.7.md import ( "fmt" ) func main () { callback(1, Add) } func Add(a, b int) { fmt.Printf("The sum of %d and %d is: %d\n", a, b, a+b); } func callback(y int, f func(int, int)) { f(y, 2) // this becomes Add(1, 2) }
相关文章推荐
- learn go recursive
- 《Go语言入门》如何在Windows下安装Go语言编程环境
- learn go passing variable-length arguments
- HDU 4268 Alice and Bob
- poj 2196 Going Home(最小费用最大流)
- Thinking in Google Doc - ActionBar讲解
- Thinking in Google Doc-不同设备适配
- learn go error
- hdu 5546 Ancient Go
- django初探
- Golang热加载配置实践
- Go语言程序测试
- learn go random
- Go 语言运算符
- Go 语言常量
- 使用Blender创造一个Low Polygon 插画
- Go 语言变量
- Go 语言数据类型
- Go 语言基础语法
- Go 语言结构