-
Notifications
You must be signed in to change notification settings - Fork 20
/
test.go
126 lines (104 loc) 路 1.31 KB
/
test.go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package main
import "fmt"
/*
type myinterface interface {
x()
y()
}
type mystruct struct {
x int
y int
}
*/
var ga int
type myint int
type mymyint myint
type bool int
type mybool bool
func f0() {
}
func fa() {
fmt.Printf("%d\n", ga) // => 0
}
/* this is
a
block
comment
* /
*
/
*/
func fb() {
fmt.Printf("%d\n", 1) // this is a comment
fmt.Printf("%d\n", 4-2)
fmt.Printf("%d\n", 1+1+1) // this is another comment //
fmt.Printf("%d\n", 1*2+2)
fmt.Printf("%d\n", 2*3-1)
fmt.Printf("%d\n", 9-1-2)
}
func fc() {
var i int
i = 7
fmt.Printf("%d\n", i)
}
func fd() {
var j int = 2
fmt.Printf("%d\n", j*4)
}
func fe() {
var a int = 5
var b int = 4
fmt.Printf("%d\n", a+b)
}
func ff() {
//fmt.Printf("%v%v\n", true, false)
}
func fg(a int, b int) {
fmt.Printf("%d\n", a+b)
}
var gc int
var gd int = 10
var ge = 2
func fh() {
fmt.Printf("%d\n", gc+gd+ge)
}
const c0 int = 1
const c1 = 2
func fi() {
const c1 int = 3
const c2 = 9
fmt.Printf("%d\n", c0+c1+c2)
}
var gb int = 14
func f14() {
fmt.Printf("%d\n", gb)
}
var garbage int
func f15() {
var sum int
var i int
var a int
var b int
/*
for a, b := range []int{1,2,3} {
sum = a + b
}
*/
i = sum + a + b
sum = i
}
func main() {
f0()
fa()
fb()
fc()
fd()
fe()
ff()
fg(5, 6)
fh()
fi()
f14()
f15()
fmt.Printf("hello world\n")
}