Basic types

suggest change

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

type literal
bool true, false
int, int8, uint8, int16, uint16, int32, uint32, int64, uint64 38
float64, float32 (floating-point numbers) 23.5, 2e-12
byte (alias of uint8) 'a'
rune (alias of int32, a Unicode code point) 'p'
string "foo", `bar`
constants const a = 8
structs type Foo struct {}
slice (variable-sized sequence) []int{1, -3, 4}
array (fixed-size sequence) [2]int{2, -3}
map (known as dictionary or hash table in other languages) map[string]int

Booleans

Integers

Floating-point numbers

Characters and runes

Strings

Constants

Enums

Arrays

Slices

Maps

Structs

Interfaces

Empty interface

Pointers

Unions

Channels

Zero values

Type casting

Type aliases

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents