github.com/goplus/llgo@v0.8.3/cl/_testrt/result/in.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/goplus/llgo/internal/runtime/c"
     5  )
     6  
     7  func main() {
     8  	fn := func() func(int, int) int {
     9  		return func(x, y int) int {
    10  			return x + y
    11  		}
    12  	}()
    13  	c.Printf(c.Str("%d\n"), fn(100, 200))
    14  	c.Printf(c.Str("%d\n"), add()(100, 200))
    15  	fn, n := add2()
    16  	c.Printf(c.Str("%d %d\n"), add()(100, 200), n)
    17  }
    18  
    19  func add() func(int, int) int {
    20  	return func(x, y int) int {
    21  		return x + y
    22  	}
    23  }
    24  
    25  func add2() (func(int, int) int, int) {
    26  	return func(x, y int) int {
    27  		return x + y
    28  	}, 1
    29  }