forked from goki/gotopy
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbasic.input
More file actions
55 lines (48 loc) · 846 Bytes
/
Copy pathbasic.input
File metadata and controls
55 lines (48 loc) · 846 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
43
44
45
46
47
48
49
50
51
52
53
54
55
package test
var (
GlobInt int = 2
GlobStr = "a string"
GlobBool = false
)
// A struct definition
type MyStru struct {
A int // field desc
B float32 `desc:"field tag"`
C string `desc:"more tags"`
}
// A global function
func GlobFun(a, b float32) float32 {
if a > b && a == 0 || b == 0 {
return a + b
} else if a == b {
return a * b
} else {
return a - b
}
}
// MethOne does something
func (st *MyStru) MethOne(arg1 float32) int {
rv := st.A
for _, a := range SomeList {
rv += a
}
st.A = true
ano := MyStru{A: 22, B: 44.2, C: "happy"}
return rv
}
// MethTwo does something
// it is pretty cool
// not really sure about that
func (st *MyStru) MethTwo(arg1, arg2 float32, arg3 int) int {
rv := st.A
for a := 0; a < 100; a++ {
rv += a
}
switch rv {
case 100:
rv *= 2
case 500:
rv /= 5
}
return rv
}