go学习笔记(03)-基本语法-数据类型

数据类型

分类

  • 布尔:bool
    • true or false
  • 整型:int/uint 根据平台可能为32位或64位
  • 8位整型:int8/uint8
  • 字节:byte(uint8别名)
  • 16位整型:int16/uint16
  • 32位整型:int32/uint32
  • rune(int32别名)
  • 64位整型:int64/uint64
  • 浮点:float32/float64
  • 复数:complex64/complex128
  • 足够保存指针的32和64位整型:uintptr 根据平台可能为32位或64位
  • 其它类型:
    • array, struct, string
  • 引用类型:
    • slice, map, chan
  • 接口:interface
  • 函数:func

类型零值

零值其实就是变量被声明为某一类型后的默认值,值类型为0,bool为false,string为""

类型别名

type (
	type1 float32
	type2 string
)
posted @ 2015-01-31 22:04  doitNow  阅读(177)  评论(0)    收藏  举报