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);
}

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: