mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 22:06:51 +08:00
@@ -26,7 +26,7 @@ func callback(y int, f func(int, int)) {
|
||||
|
||||
The sum of 1 and 2 is: 3
|
||||
|
||||
将函数作为参数的最好的例子是函数 `strings.InfexFunc()`:
|
||||
将函数作为参数的最好的例子是函数 `strings.IndexFunc()`:
|
||||
|
||||
该函数的签名是 `func IndexFunc(s string, f func(c int) bool) int`,它的返回值是在函数 `f(c)` 返回 true、-1 或从未返回时的索引值。
|
||||
|
||||
@@ -56,4 +56,4 @@ func run(op binOp, req *Request) { … }
|
||||
|
||||
- [目录](directory.md)
|
||||
- 上一节:[将函数作为参数](06.7.md)
|
||||
- 下一节:[闭包](06.8.md)
|
||||
- 下一节:[闭包](06.8.md)
|
||||
|
Reference in New Issue
Block a user