Variable Types In Golang
Variables are one of the foundational building blocks of any programming language, Without understanding them it’s difficult to understand any programming language, the main goal of this post is to give you the big picture of variable types in Golang which will make it easier to understand them and to understand the language. Variables in Golang can be classified into two main categories:
- Basic types (like int, float, string and so)
- Composite types (like struct, channel, interface and so) Here is a complete list of the basic variable types in Golang:
- Numeric types
- int8
- uint8
- byte (alias for uint8)
- int16
- uint16
- int32
- uint32
- rune (alias for int32)
- int64
- unit64
- Boolean Types
- bool
- String Types
- string
Here is a complete list of the composite variable types in Golang:
- struct
- array
- interface
- slice
- map
- interface
- pointer
- channel
- function
Comments