mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-07 09:20:22 +00:00
30 lines
396 B
Plaintext
30 lines
396 B
Plaintext
// ## Built-in Types
|
|
bool
|
|
|
|
string
|
|
|
|
int int8 int16 int32 int64
|
|
uint uint8 uint16 uint32 uint64 uintptr
|
|
|
|
byte // alias for uint8
|
|
|
|
rune // alias for int32 ~= a character (Unicode code point) - very Viking
|
|
|
|
float32 float64
|
|
|
|
complex64 complex128
|
|
|
|
// ## Type Conversions
|
|
|
|
var i int = 42
|
|
var f float64 = float64(i)
|
|
var u uint = uint(f)
|
|
|
|
// alternative syntax
|
|
i := 42
|
|
f := float64(i)
|
|
u := uint(f)
|
|
|
|
|
|
|