github.com/HaHadaxigua/yaegi@v1.0.1/_test/fun26.go (about)

     1  package main
     2  
     3  type F func() (int, error)
     4  
     5  func f1() (int, error) { return 3, nil }
     6  
     7  func f2(a string, f F) {
     8  	c, _ := f()
     9  	println(a, c)
    10  }
    11  
    12  func main() {
    13  	f2("hello", F(f1))
    14  }
    15  
    16  // Output:
    17  // hello 3