Variable in Golang tutorial 2
Variable in Golang tutorial 2
Variable declaration is little bit different from other programming langauges.
- variable strat with “var” keyword.
- Followed by variable name.
- Then followed by variable type.
var a int
default of variable is zero.
Note: It is not allowed in golang to declare variable and leave it without using.
package main import "fmt" func main(){ var a int fmt.Print(a); }