Skip to content

Commit 82f0025

Browse files
committed
🎨 go-06
1 parent eba718d commit 82f0025

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

go-06/array_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package go_06
2+
3+
import "testing"
4+
5+
func TestArray(t *testing.T) {
6+
var arr [3]int
7+
t.Log(arr[1])
8+
9+
arr1:=[...]int{1,2,3}
10+
t.Log(arr1[1])
11+
}
12+
13+
func TestArrayTravel(t *testing.T) {
14+
arr:=[...]int{1,2,3,4}
15+
16+
for idx,e:=range arr{
17+
t.Log(idx,e)
18+
}
19+
20+
t.Log(arr[1:len(arr)])
21+
}

0 commit comments

Comments
 (0)