Skip to content

Commit 1cfe03b

Browse files
committed
check
1 parent df68c76 commit 1cfe03b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

slice/pop.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ import (
66

77
func main() {
88
s := []int{1, 2, 3, 4, 5}
9+
s2 := s
910
for {
10-
if len(s) == 0 {
11+
if len(s)-1 == 0 {
1112
break
1213
}
1314

1415
v := s[0] // get first element
1516
s = s[1:] // pop first element
1617
fmt.Printf("v: %v; s: %v; cap(%d); len(%d) \n", v, s, cap(s), len(s))
1718
}
19+
20+
s[0] = 100500
21+
22+
fmt.Println("s2: ", s2)
1823
}

0 commit comments

Comments
 (0)