1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| package main
import "fmt"
func test(a string, b int) int { fmt.Println("a ", a) fmt.Println("b ", b) c := 11 return c }
func test1(a string, b int) (int, int) { fmt.Println("method name =", a) fmt.Println("arg int =", b) return 22, 33 }
func test2(a string, b int) (r1 int, r2 int) { fmt.Println("method name =", a) fmt.Println("arg int =", b) fmt.Println("r1 = ", r1) fmt.Println("r2 = ", r2) r1 = 44 r2 = 55 return } func main() { c := test("123", 512) fmt.Println("c= ", c)
ret1, ret2 := test1("test1", 1024) fmt.Println("ret1 , ret2 :", ret1, ret2)
ret3, ret4 := test2("test2", 2048) fmt.Println("ret3 , ret4 :", ret3, ret4) }
|