Basic Types
Go does have a wide range of built-in types as well as allows the programmer to define custom types. We would discuss these later in depths. Here are some basic types that one should know before proceeding forward
Bit size of int, uint, uintptr depends on system architecture. On 32 bit system, they would be assumed to 32 bit wide, while on 64 bit system, they would be 64 bit wide.
Usually using int
should suffice unless we have specific reason to use signed, unsigned or other varying types of integers/floats.
Type Conversions
Go allows type conversion from one type to another via T(v)
where T
is type to cast to v
is value to be typecasted.
In Golang, var of one type can not be assigned value of other type unless converted
Last updated