Basic types are :
bool
string
int int8 int16 int32 int64
uint uint8 uint16 uint32 uint64 uintptr
byte // alias for uint8
rune // alias for int32
// represents a Unicode code point
float32 float64
complex64 complex128Formatting
- %T will show the type
- %v will take the value as literal
Conversion
For converting from one type to another, I can pass in the type to be transformed from as a argument into the type to be transformed to.
func main(){
var six int = 6
six_float32 := float32(6)
}Inference
when using implicit declaration via := or var = the type will be inferred based on what value is on the right hand side. for eg:
-
i := 1 // Int j := 1.00002 // float64 by default float values k := 1-2i // complex128 by default complex values