我正在尝试组合切片 [1, 2]
和切片 [3, 4]
。我怎么能在围棋中做到这一点?
我试过了:
append([]int{1,2}, []int{3,4})
但得到:
cannot use []int literal (type []int) as type int in append
但是, 文档 似乎表明这是可能的,我错过了什么?
slice = append(slice, anotherSlice...)
原文由 Kevin Burke 发布,翻译遵循 CC BY-SA 4.0 许可协议
在第二个切片后添加点:
这就像任何其他可变参数函数一样。