golang data

Integer type

   Golang TYPE integers: signed and unsigned, int uint size and related systems. 

  Golang view the data type of a variable:

main Package 

Import  " FMT " 
FUNC main () { 
    var n1 = 100 
    fmt.Printf ( " Type T n1 of% " , n1) 
}

Floating-point type

= + Sign bit floating-point exponent bit mantissa bits +

Mantissa part may be lost, resulting in loss of precision

func main() {
    var num3 float32 = -123.0000901
    var num4 float64 = -123.0000901
    fmt.Println("num3=", num3, "num4=", num4)
}

float64 higher accuracy than float32

Character Types

golang No special character type, if you want to store a single character (letter) is generally used to save byte.

Character string is a string of fixed length connecting the character sequence. Go strings are connected by a single byte. That is the traditional character by the characters, and different Go strings, it is by bytes.

Guess you like

Origin www.cnblogs.com/xiangxiaolin/p/11689470.html