我想合并 [1, 2]
和 [3, 4]
两个切片,尝试了下面的方式:
append([]int{1,2}, []int{3,4})
但是报错:
cannot use []int literal (type []int) as type int in append
我想合并 [1, 2]
和 [3, 4]
两个切片,尝试了下面的方式:
append([]int{1,2}, []int{3,4})
但是报错:
cannot use []int literal (type []int) as type int in append
第二个参数后面少了 ...
:
append([]int{1,2}, []int{3,4}...)