fixed clear list in Go

This commit is contained in:
machangxin 2022-12-18 21:57:29 +08:00
parent 71c3ed70a4
commit 4fa41ce08a
2 changed files with 2 additions and 2 deletions

View file

@ -25,7 +25,7 @@ func TestList(t *testing.T) {
fmt.Println("将索引 1 处的元素更新为 0 ,得到 list =", list)
/* 清空列表 */
list = []int{}
list = nil
fmt.Println("清空列表后 list =", list)
/* 尾部添加元素 */

View file

@ -208,7 +208,7 @@ comments: true
```go title="list_test.go"
/* 清空列表 */
list = []int{}
list = nil
/* 尾部添加元素 */
list = append(list, 1)