Basic types
suggest changeGo 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 char) | 'a' |
rune (alias of int32, a unicode character) | 'p' |
string | "foo", `bar` |
constants | const a = 8 |
structs | type Foo struct {} |
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 |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents