Variables in the Go Programming Language(golang)

Assigning a variable

//Variable is declared.
var codingLanguage string
//Variable is assigned.
codingLanguage = "GO"
var codingLanguage string = "golang"
number := 11

Block variables

var sport string = "Football"
var position string = "Quarterback"
var playerName string = "Jimmy Garoppolo"
var playerNumber int = 10
var (
sport string = "Football"
position string = "Quarterback"
playerName string = "Jimmy Garoppolo"
playerNumber int = 10
)

Constants

const randomFact string = "Pteronophobia is the fear of feathers or being tickled by feathers"randomFact = "Bananas are curved because they grow closer to the sun"//This would return an error because we've already declared that the random fact will be and it cannot be overwritten

Shadowing

Converting Datatypes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store