GoLang Data Types

Data Type in GoLang:

From its name ‘data-type,’ it is pretty clear that it defines which type of data is holding by the variable. It clarifies the type of data (value) is holding by the variables in the go program. This data type tells the compiler how much memory from the storage will occupy by the go program variable. Each data type has pre-defined storage in go language.

 In the go language, the data type can be categorized into four parts. These four parts are given below:

  1. Basic Data Type: There are few more sub-categories in the basic data type. These sub-categories are given below:
    • Numbers
    • String
    • Booleans
  2. Aggregate Data Type: Sub-categories of the aggregate data type are given below:
    • Array
    • Structure
  3. Reference Data Type: Sub-categories of the reference data type are given below:
    • Pointer
    • Slices
    • Maps
    • Function
    • Channels
  4. Interface Data Type

Numbers:

In the Go language, numbers can be further divided into three parts. These parts are:

  1. Integer numbers
  2. Floating point number
  3. Complex number



ADVERTISEMENT
ADVERTISEMENT