Go's Built-in Types
int, float64, string, bool and their zero values
Go's Type System Overview
Go has a rich set of built-in types organized into categories:
- Boolean:
bool - Integer:
int,int8,int16,int32,int64and unsigned variants - Float:
float32,float64 - String:
string - Complex:
complex64,complex128
Integer Types
Go provides platform-dependent and fixed-size integer types:
int/uint— platform size (32 or 64 bit)int8…int64— fixed bit widthsbyte— alias foruint8rune— alias forint32, represents a Unicode code point
Use int for general-purpose integers unless you need a specific width.
All lessons in this course
- Declaring Variables in Go
- Go's Built-in Types
- Constants and iota
- Type Conversions in Go