-
Notifications
You must be signed in to change notification settings - Fork 0
/
testBlock.go
63 lines (54 loc) · 860 Bytes
/
testBlock.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
package main
import (
"fmt"
"time"
)
func funtest() {
fmt.Println("f")
}
func main() {
{ // start outer block
a := 1
fmt.Println(a)
{ // start inner block
b := 2
fmt.Println(a)
fmt.Println(b)
} // end inner block
} // end outer block
// for i := 0; i < 10; i++ {
// //fmt.Printf("%p \n", c)
// fmt.Print("N", i)
// i := i
// go func() {
// fmt.Println(i)
// }()
// }
if i := 5; i >= 0 {
fmt.Println(i)
var i int = 7
fmt.Println(i)
}
switch i := 2; i * 4 {
case 8:
j := i * 2
fmt.Println(j)
default:
fmt.Println("default")
}
//time.Sleep(5 * time.Second)
tick := time.Tick(100 * time.Millisecond)
LOOP:
for {
select {
case <-tick:
i := 0
fmt.Println("tick", i)
break LOOP
default:
// "i" is undefined here
time.Sleep(30 * time.Millisecond)
fmt.Println("sleep")
}
}
}