package main func a() bool { s := []int{8,8} s[1] -= 9 k := s[1] == -1 return k } func f2() { var j int var s = []int{10, 20} var s2 = []int{100, 200} for _, v := range s { j += v for _, v2 := range s2{ j += v2 for _, v := range s { j += v } } } assert(j == 750) } func slice_slice() { s := []int{1,2,3,4} s1 := s[:1] assert(len(s1) == 1) assert(cap(s1) == 4) s2 := s[1:] assert(len(s2) == 3) assert(cap(s2) == 3) s3 := s[1:2:2] assert(s3[0] == 2) assert(len(s3) == 1) assert(cap(s3) == 1) } func main() { var s1 = [][]int{{0},{99},{2}} var s2 = []int{0,100,2} i := s1[1][0] + s2[1] - 1 s2[0] = 8 j := s2[0] assert(i == 198) assert(j == 8) assert(a()) f2() slice_slice() }