go语言基础到提高(3)-变量
x: 100 y: 100 z: 102.11 z2: 100 z3: 12
go語言數據類型
復數
type ComplexType
ComplexType is here for the purposes of documentation only. It is a stand-in for either complex type: complex64 or complex128.
浮點數
type FloatType
FloatType is here for the purposes of documentation only. It is a stand-in for either float type: float32 or float64.
整數
type IntegerType
IntegerType is here for the purposes of documentation only. It is a stand-in for any integer type: int, uint, int8 etc.
Type類型,任何go類型,但對于任何給定的函數調用,都代表相同的類型
type Type
Type is here for the purposes of documentation only. It is a stand-in for any Go type, but represents the same type for any given function invocation.
布爾
type bool
bool is the set of boolean values, true and false.
字節
type byte
byte is an alias for uint8 and is equivalent to uint8 in all ways. It is used, by convention, to distinguish byte values from 8-bit unsigned integer values.
type complex128
complex128 is the set of all complex numbers with float64 real and imaginary parts.
type complex64
complex64 is the set of all complex numbers with float32 real and imaginary parts.
錯誤
type error
The error built-in interface type is the conventional interface for representing an error condition, with the nil value representing no error.
type error interface {
Error() string
}
type float32
float32 is the set of all IEEE-754 32-bit floating-point numbers.
type float64
float64 is the set of all IEEE-754 64-bit floating-point numbers.
type int
int is a signed integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, int32.
type int16
int16 is the set of all signed 16-bit integers. Range: -32768 through 32767.
type int32
int32 is the set of all signed 32-bit integers. Range: -2147483648 through 2147483647.
type int64
int64 is the set of all signed 64-bit integers. Range: -9223372036854775808 through 9223372036854775807.
type int8
int8 is the set of all signed 8-bit integers. Range: -128 through 127.
rune是int32的別名,在所有方面都等同于int32。按照慣例,它用于區分字符值和整數值。
type rune
rune is an alias for int32 and is equivalent to int32 in all ways. It is used, by convention, to distinguish character values from integer values.
字符串
type string
string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text. A string may be empty, but not nil. Values of string type are immutable.
無符號整數
type uint
uint is an unsigned integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, uint32.
type uint16
uint16 is the set of all unsigned 16-bit integers. Range: 0 through 65535.
type uint32
uint32 is the set of all unsigned 32-bit integers. Range: 0 through 4294967295.
type uint64
uint64 is the set of all unsigned 64-bit integers. Range: 0 through 18446744073709551615.
type uint8
uint8 is the set of all unsigned 8-bit integers. Range: 0 through 255.
uintptr是一個整數類型,其大小足以容納任何指針的位模式。
type uintptr
uintptr is an integer type that is large enough to hold the bit pattern of any pointer.
true 12 12.05
package main import("fmt" ) func main(){ var y1,y2,y3 inty1=1y2=2y3=3fmt.Println(y1,y2,y3)} package main import("fmt" ) func main(){ var a1,a2,a3 inta1,a2,a3=11,22,33fmt.Println(a1,a2,a3)} 與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的go语言基础到提高(3)-变量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql 磁盘限额_Linux运维知识
- 下一篇: Java并发——线程安全