github.com/goplus/gop@v1.2.6/printer/_testdata/15-ErrWrap/err_wrap.gop (about)

     1  import (
     2  	"strconv"
     3  )
     4  
     5  func add(x, y string) (int, error) {
     6  	return strconv.Atoi(x)? + strconv.Atoi(y)?, nil
     7  }
     8  
     9  func addSafe(x, y string) int {
    10  	return strconv.Atoi(x)?:0 + strconv.Atoi(y)?:0
    11  }
    12  
    13  println(`add("100", "23"):`, add("100", "23")!)
    14  
    15  sum, err := add("10", "abc")
    16  println(`add("10", "abc"):`, sum, err)
    17  
    18  println(`addSafe("10", "abc"):`, addSafe("10", "abc"))