Skip to content

Instantly share code, notes, and snippets.

@hi-manshu
Last active July 12, 2018 14:20
Show Gist options
  • Save hi-manshu/6ca8121e8d23343fa38bea984ea682d1 to your computer and use it in GitHub Desktop.
Save hi-manshu/6ca8121e8d23343fa38bea984ea682d1 to your computer and use it in GitHub Desktop.
//We declare variable in Go
var variableName dataType
//Here firstName is variable of data-type string
eg: var firstName string = "Himanshu"
// We can define multiple variables with same dataTypes
var variableName, variableName, variableName dataType
//Here multiple variable are declared of same data-type
var firstName,lastName string
// We can also define variable with a initial value
var variableName type = value
//Here firstName is variable where it is assigned a value Himanshu
eg: var firstName string = "Himanshu"
// We can also define multiple variables with initial values
var variableName1, variableName2 type = value1, value2
//Here multiple variable are declared of same data-type
var firstName,lastName string = "Himanshu","Singh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment