Go的变量类型

51 阅读1分钟

Go语言的变量类型有:

  1. 基本类型

    • 整型,包括int,uint,int8,uint8,int16,uint16,int32,uint32,int64,uint64,byte (uint8 的别名),rune (int32 的别名 代表一个 Unicode 码),uintptr等

    • 浮点型,包括float32,float64

    • 复数类型,包括complex64,complex128

    • 字符串类型,string

    • 布尔型,bool

  2. 复合类型

    • 数组

    • struct结构体

  3. 引用类型

    • slice

    • map

    • channel

    • pointer or 引用类型

  4. 接口类型

    • io.Reader, io.Writer,error等