Skip to content

Instantly share code, notes, and snippets.

@hi-manshu
Created July 12, 2018 15:01
Show Gist options
  • Save hi-manshu/3f7c70a93f5528f9762612b228d8f92f to your computer and use it in GitHub Desktop.
Save hi-manshu/3f7c70a93f5528f9762612b228d8f92f to your computer and use it in GitHub Desktop.
package main
//imported the package fmt
import "fmt"
func main() {
//main function gets called when the program runs
// declared the first variable with datatype int
var firstNumber int = 10
// declared the second variable without any datatype
var secondNumber = 20
// declared the third variable without any datatype and keyword Var
thirdNumber := 30
additionOfThreeNumbers := firstNumber + secondNumber + thirdNumber
//will display the result of the addition in terminal
fmt.Println(additionOfThreeNumbers)
}
>>go run numericalGoExample.go
>>60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment