mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 01:36:29 +08:00
fixed clear list in Go
This commit is contained in:
parent
71c3ed70a4
commit
4fa41ce08a
2 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ func TestList(t *testing.T) {
|
||||||
fmt.Println("将索引 1 处的元素更新为 0 ,得到 list =", list)
|
fmt.Println("将索引 1 处的元素更新为 0 ,得到 list =", list)
|
||||||
|
|
||||||
/* 清空列表 */
|
/* 清空列表 */
|
||||||
list = []int{}
|
list = nil
|
||||||
fmt.Println("清空列表后 list =", list)
|
fmt.Println("清空列表后 list =", list)
|
||||||
|
|
||||||
/* 尾部添加元素 */
|
/* 尾部添加元素 */
|
||||||
|
|
|
@ -208,7 +208,7 @@ comments: true
|
||||||
|
|
||||||
```go title="list_test.go"
|
```go title="list_test.go"
|
||||||
/* 清空列表 */
|
/* 清空列表 */
|
||||||
list = []int{}
|
list = nil
|
||||||
|
|
||||||
/* 尾部添加元素 */
|
/* 尾部添加元素 */
|
||||||
list = append(list, 1)
|
list = append(list, 1)
|
||||||
|
|
Loading…
Reference in a new issue