Global Variable Golang tutorial 5

Global Variable Golang tutorial 5

If you want to declare a global variable. You should declare it out “main” function.

It should start with Capital Letter.

var Sun int = 3
func main(){
}

Source Code

package main
import "fmt"
var Sun int = 420
func main(){
fmt.Print(Sun);
}
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: