Go edit forum

Basic types

Go supports all the basic types that you would expect from a statically typed language:

typeliteral
booltrue, false
int, int8, uint8, in16, uint61, int32, uint32, int64, uint6438
float64, float32 (floating-point numbers)23.5, 2e-12
char (alias of int8, a byte character)'a'
rune (alias of int32, a unicode character) 
string"foo", `bar`
slice (variable-sized vector)[]int = {1, -3, 4}
array (fixed-size vector)[2]int = {2, -3}
map (known as dictionary or hash table in other languages)map[string]int
structstype Foo struct {}
constantsconst a = 8
typeliteral
booltrue, false
int, int8, uint8, in16, uint61, int32, uint32, int64, uint6438
float64, float32 (floating-point numbers)23.5, 2e-12
char (alias of int8, a byte character)'a'
rune (alias of int32, a unicode character) 
string"foo", `bar`
slice (variable-sized vector)[]int = {1, -3, 4}
array (fixed-size vector)[2]int = {2, -3}
map (known as dictionary or hash table in other languages)map[string]int
structstype Foo struct {}
constantsconst a = 8

 

  ↑ ↓ to navigate     ↵ to select     Esc to close