Variables and Data Types
Variables in Go are statically typed and can be declared using the var
keyword or using short declaration syntax (:=
).
var name string = "GoLang"
var age int = 10
// Short declaration
count := 5
Common data types in Go:
int
,float64
- Numbersstring
- Textbool
- Booleanarray
,slice
,map
- Collections