<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # package builtin `import "builtin"` builtin?包為Go的預聲明標識符提供了文檔。此處列出的條目其實并不在[builtin](https://godoc.org/builtin) 包中,對它們的描述只是為了讓?godoc?給該語言的特殊標識符提供文檔。 ## Index * [Constants](#pkg-constants) * [type bool](#bool) * [type byte](#byte) * [type rune](#rune) * [type int](#int) * [type int8](#int8) * [type int16](#int16) * [type int32](#int32) * [type int64](#int64) * [type uint](#uint) * [type uint8](#uint8) * [type uint16](#uint16) * [type uint32](#uint32) * [type uint64](#uint64) * [type float32](#float32) * [type float64](#float64) * [type complex64](#complex64) * [type complex128](#complex128) * [type uintptr](#uintptr) * [type string](#string) * [type error](#error) * [type Type](#Type) * [type Type1](#Type1) * [type IntegerType](#IntegerType) * [type FloatType](#FloatType) * [type ComplexType](#ComplexType) * [func real(c ComplexType) FloatType](#real) * [func imag(c ComplexType) FloatType](#imag) * [func complex(r, i FloatType) ComplexType](#complex) * [func new(Type) \*Type](#new) * [func make(Type, size IntegerType) Type](#make) * [func cap(v Type) int](#cap) * [func len(v Type) int](#len) * [func append(slice []Type, elems ...Type) []Type](#append) * [func copy(dst, src []Type) int](#copy) * [func delete(m map[Type]Type1, key Type)](#delete) * [func close(c chan&lt;- Type)](#close) * [func panic(v interface{})](#panic) * [func recover() interface{}](#recover) * [func print(args ...Type)](#print) * [func println(args ...Type)](#println) ## Constants ``` const ( true = 0 == 0 // 無類型布爾值 false = 0 != 0 // 無類型布爾值 ) ``` true?和false是兩個無類型布爾值。 ``` const iota = 0 // 無類型整數值 ``` iota是一個預定義的標識符,代表順序按行增加的無符號整數,每個const聲明單元(被括號括起來)相互獨立,分別從0開始。 ## type [bool](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L14 "View Source") ``` type bool bool ``` 布爾類型。 ## type [byte](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L88 "View Source") ``` type byte byte ``` 8位無符號整型,是uint8的別名,二者視為同一類型。 ## type [rune](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L92 "View Source") ``` type rune rune ``` 32位有符號整形,int32的別名,二者視為同一類型。 ## type [int](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L75 "View Source") ``` type int int ``` 至少32位的有符號整形,但和int32/rune并非同一類型。 ## type [int8](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L40 "View Source") ``` type int8 int8 ``` 8位有符號整形,范圍[-128, 127]。 ## type [int16](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L44 "View Source") ``` type int16 int16 ``` 16位有符號整形,范圍[-32768, 32767]。 ## type [int32](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L48 "View Source") ``` type int32 int32 ``` 32位有符號整形,范圍[-2147483648, 2147483647]。 ## type [int64](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L52 "View Source") ``` type int64 int64 ``` 64位有符號整形,范圍[-9223372036854775808, 9223372036854775807]。 ## type [uint](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L79 "View Source") ``` type uint uint ``` 至少32位的無符號整形,但和uint32不是同一類型。 ## type [uint8](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L24 "View Source") ``` type uint8 uint8 ``` 8位無符號整型,范圍[0, 255]。 ## type [uint16](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L28 "View Source") ``` type uint16 uint16 ``` 16位無符號整型,范圍[0, 65535]。 ## type [uint32](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L32 "View Source") ``` type uint32 uint32 ``` 32位無符號整型,范圍[0, 4294967295]。 ## type [uint64](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L36 "View Source") ``` type uint64 uint64 ``` 64位無符號整型,范圍[0, 18446744073709551615]。 ## type [float32](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L55 "View Source") ``` type float32 float32 ``` 所有IEEE-754 32位浮點數的集合,12位有效數字。 ## type [float64](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L58 "View Source") ``` type float64 float64 ``` 所有IEEE-754 64位浮點數的集合,16位有效數字。 ## type [complex64](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L62 "View Source") ``` type complex64 complex64 ``` 具有float32?類型實部和虛部的復數類型。 ## type [complex128](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L66 "View Source") ``` type complex128 complex128 ``` 具有float64?類型實部和虛部的復數類型。 ## type [uintptr](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L83 "View Source") ``` type uintptr uintptr ``` 可以保存任意指針的位模式的整數類型。 ## type [string](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L71 "View Source") ``` type string string ``` 8位byte序列構成的字符串,約定但不必須是utf-8編碼的文本。字符串可以為空但不能是nil,其值不可變。 ## type [error](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L254 "View Source") ``` type error interface { Error() string } ``` 內建error接口類型是約定用于表示錯誤信息,nil值表示無錯誤。 ## type [Type](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L106 "View Source") ``` type Type int ``` 在本文檔中代表任意一個類型,但同一個聲明里只代表同一個類型。 ``` var nil Type // Type必須是指針、通道、函數、接口、映射或切片 ``` nil是預定義的標識符,代表指針、通道、函數、接口、映射或切片的零值。 ## type [Type1](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L111 "View Source") ``` type Type1 int ``` 在本文檔中代表任意一個類型,但同一個聲明里只代表同一個類型,用于代表和Type不同的另一類型。 ## type [IntegerType](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L115 "View Source") ``` type IntegerType int ``` 在本文檔中代表一個有符號或無符號的整數類型。 ## type [FloatType](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L119 "View Source") ``` type FloatType float32 ``` 在本文檔中代表一個浮點數類型。 ## type [ComplexType](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L123 "View Source") ``` type ComplexType complex64 ``` 在本文檔中代表一個復數類型。 ## func [real](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L198 "View Source") ``` func real(c ComplexType) FloatType ``` 返回復數c的實部。 ## func [imag](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L203 "View Source") ``` func imag(c ComplexType) FloatType ``` 返回復數c的虛部。 ## func [complex](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L194 "View Source") ``` func complex(r, i FloatType) ComplexType ``` 使用實部r和虛部i生成一個復數。 ## func [new](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L187 "View Source") ``` func new(Type) *Type ``` 內建函數new分配內存。其第一個實參為類型,而非值。其返回值為指向該類型的新分配的零值的指針。 ## func [make](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L182 "View Source") ``` func make(Type, size IntegerType) Type ``` 內建函數make分配并初始化一個類型為切片、映射、或通道的對象。其第一個實參為類型,而非值。make的返回類型與其參數相同,而非指向它的指針。其具體結果取決于具體的類型: ``` 切片:size指定了其長度。該切片的容量等于其長度。切片支持第二個整數實參可用來指定不同的容量; 它必須不小于其長度,因此?make([]int, 0, 10)?會分配一個長度為0,容量為10的切片。 映射:初始分配的創建取決于size,但產生的映射長度為0。size可以省略,這種情況下就會分配一個 小的起始大小。 通道:通道的緩存根據指定的緩存容量初始化。若?size為零或被省略,該信道即為無緩存的。 ``` ## func [cap](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L164 "View Source") ``` func cap(v Type) int ``` 內建函數cap返回?v?的容量,這取決于具體類型: ``` 數組:v中元素的數量,與?len(v)?相同 數組指針:*v中元素的數量,與len(v)?相同 切片:切片的容量(底層數組的長度);若?v為nil,cap(v)?即為零 信道:按照元素的單元,相應信道緩存的容量;若v為nil,cap(v)即為零 ``` ## func [len](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L155 "View Source") ``` func len(v Type) int ``` 內建函數len返回?v?的長度,這取決于具體類型: ``` 數組:v中元素的數量 數組指針:*v中元素的數量(v為nil時panic) 切片、映射:v中元素的數量;若v為nil,len(v)即為零 字符串:v中字節的數量 通道:通道緩存中隊列(未讀取)元素的數量;若v為?nil,len(v)即為零 ``` ## func [append](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L134 "View Source") ``` func append(slice []Type, elems ...Type) []Type ``` 內建函數append將元素追加到切片的末尾。若它有足夠的容量,其目標就會重新切片以容納新的元素。否則,就會分配一個新的基本數組。append返回更新后的切片,因此必須存儲追加后的結果。 ``` slice = append(slice, elem1, elem2) slice = append(slice, anotherSlice...) ``` 作為特例,可以向一個字節切片append字符串,如下: ``` slice = append([]byte("hello "), "world"...) ``` ## func [copy](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L141 "View Source") ``` func copy(dst, src []Type) int ``` 內建函數copy將元素從來源切片復制到目標切片中,也能將字節從字符串復制到字節切片中。copy返回被復制的元素數量,它會是?len(src)?和?len(dst)?中較小的那個。來源和目標的底層內存可以重疊。 ## func [delete](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L146 "View Source") ``` func delete(m map[Type]Type1, key Type) ``` 內建函數delete按照指定的鍵將元素從映射中刪除。若m為nil或無此元素,delete不進行操作。 ## func [close](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L213 "View Source") ``` func close(c chan<- Type) ``` 內建函數close關閉信道,該通道必須為雙向的或只發送的。它應當只由發送者執行,而不應由接收者執行,其效果是在最后發送的值被接收后停止該通道。在最后的值從已關閉的信道中被接收后,任何對其的接收操作都會無阻塞的成功。對于已關閉的信道,語句: ``` x, ok := <-c ``` 還會將ok置為false。 ## func [panic](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L226 "View Source") ``` func panic(v interface{}) ``` 內建函數panic停止當前Go程的正常執行。當函數F調用panic時,F的正常執行就會立刻停止。F中defer的所有函數先入后出執行后,F返回給其調用者G。G如同F一樣行動,層層返回,直到該Go程中所有函數都按相反的順序停止執行。之后,程序被終止,而錯誤情況會被報告,包括引發該恐慌的實參值,此終止序列稱為恐慌過程。 ## func [recover](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L237 "View Source") ``` func recover() interface{} ``` 內建函數recover允許程序管理恐慌過程中的Go程。在defer的函數中,執行recover調用會取回傳至panic調用的錯誤值,恢復正常執行,停止恐慌過程。若recover在defer的函數之外被調用,它將不會停止恐慌過程序列。在此情況下,或當該Go程不在恐慌過程中時,或提供給panic的實參為nil時,recover就會返回nil。 ## func [print](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L243 "View Source") ``` func print(args ...Type) ``` 內建函數print以特有的方法格式化參數并將結果寫入標準錯誤,用于自舉和調試。 ## func [println](https://github.com/golang/go/blob/master/src/builtin/builtin.go#L250 "View Source") ``` func println(args ...Type) ``` println類似print,但會在參數輸出之間添加空格,輸出結束后換行。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看