go-examples/go-hello/main.go

13 lines
200 B
Go
Raw Normal View History

2017-07-07 12:29:36 +00:00
package main
import "fmt"
func visit(nums []int, callback func(...interface{}) (int, error)) {
for _, n := range nums {
callback(n)
}
}
func main() {
visit([]int{1, 2, 3, 4, 5}, fmt.Println)
}