Created
July 12, 2018 15:01
-
-
Save hi-manshu/3f7c70a93f5528f9762612b228d8f92f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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