Go: Data Types

Basic Data Types

Types Description
Boolean typesThey are boolean types and consists of the two predefined constants: (a) true (b) false
Numeric typesThey are again arithmetic types and they represent a) integer types or b) floating-point values throughout the program.
String typesA string type represents the set of string values. Its value is a sequence of bytes. Strings are immutable types that are once created, it is not possible to change the contents of a string. The predeclared string type is a string.
Derived typesThey include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types f) Slice types g) Interface types h) Map types i) Channel Types

Integer Types

uint8Unsigned 8-bit integers (0 to 255)
uint16Unsigned 16-bit integers (0 to 65535)
uint32Unsigned 32-bit integers (0 to 4294967295)
uint64Unsigned 64-bit integers (0 to 18446744073709551615)
int8Signed 8-bit integers (-128 to 127)
int16Signed 16-bit integers (-32768 to 32767)
int32Signed 32-bit integers (-2147483648 to 2147483647)
int64Signed 64-bit integers (-9223372036854775808 to 9223372036854775807)

Floating-Point Types

float32IEEE-754 32-bit floating-point numbers
float64IEEE-754 64-bit floating-point numbers
complex64Complex numbers with float32 real and imaginary parts
complex128Complex numbers with float64 real and imaginary parts

Leave a Reply

Your email address will not be published. Required fields are marked *