fixed clear list in Go
This commit is contained in:
parent
71c3ed70a4
commit
4fa41ce08a
@ -25,7 +25,7 @@ func TestList(t *testing.T) {
|
||||
fmt.Println("将索引 1 处的元素更新为 0 ,得到 list =", list)
|
||||
|
||||
/* 清空列表 */
|
||||
list = []int{}
|
||||
list = nil
|
||||
fmt.Println("清空列表后 list =", list)
|
||||
|
||||
/* 尾部添加元素 */
|
||||
|
@ -208,7 +208,7 @@ comments: true
|
||||
|
||||
```go title="list_test.go"
|
||||
/* 清空列表 */
|
||||
list = []int{}
|
||||
list = nil
|
||||
|
||||
/* 尾部添加元素 */
|
||||
list = append(list, 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user