13 lines
200 B
Go
13 lines
200 B
Go
|
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)
|
||
|
}
|