第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Go中“...Type”是什么意思?

Go中“...Type”是什么意思?

Go
慕標(biāo)琳琳 2021-09-13 16:39:50
此代碼位于builti.go:// The append built-in function appends elements to the end of a slice. If// it has sufficient capacity, the destination is resliced to accommodate the// new elements. If it does not, a new underlying array will be allocated.// Append returns the updated slice. It is therefore necessary to store the// result of append, often in the variable holding the slice itself://  slice = append(slice, elem1, elem2)//  slice = append(slice, anotherSlice...)// As a special case, it is legal to append a string to a byte slice, like this://  slice = append([]byte("hello "), "world"...)func append(slice []Type, elems ...Type) []Type最后一行讓我感到非常困惑。我不知道是什么意思...Type。這些是其他代碼:package mainimport "fmt"func main() {   s := []int{1,2,3,4,5}   s1 := s[:2]   s2 := s[2:]   s3 := append(s1, s2...)   fmt.Println(s1, s2, s3)}結(jié)果是[1 2] [3 4 5] [1 2 3 4 5]我猜 的功能...是從 中挑選所有元素elems,但我還沒有找到官方解釋。它是什么?
查看完整描述

1 回答

?
慕容708150

TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超4個(gè)贊

builtin.go 中的代碼用作文檔。代碼未編譯。

...指出這個(gè)函數(shù)的最后一個(gè)參數(shù)是可變參數(shù)。Go 語言規(guī)范記錄了可變參數(shù)函數(shù)。簡而言之,可以使用任意數(shù)量的參數(shù)作為最終參數(shù)調(diào)用可變參數(shù)函數(shù)。

類型的部分為任何圍棋類型替身。


查看完整回答
反對 回復(fù) 2021-09-13
  • 1 回答
  • 0 關(guān)注
  • 212 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)