namedresult.go
437 Bytes
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
41
42
// RUN: llgo -o %t %s
// RUN: %t 2>&1 | FileCheck %s
// CHECK: 123
// CHECK-NEXT: 456
// CHECK-NEXT: 1 2
// CHECK-NEXT: 666 0
package main
func f1() (x int) {
x = 123
return
}
func f2() (x int) {
return 456
}
func f3() (x, y int) {
y, x = 2, 1
return
}
func f4() (x, _ int) {
x = 666
return
}
func main() {
x := f1()
println(x)
x = f2()
println(x)
var y int
x, y = f3()
println(x, y)
x, y = f4()
println(x, y)
}