Created
June 21, 2022 15:45
-
-
Save rahul-yr/eaf3e7ac78f72849b3d234affabfb573 to your computer and use it in GitHub Desktop.
Addition program in go
This file contains 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 | |
import ( | |
"log" | |
"time" | |
) | |
// addTwoNumbers adds two numbers together and prints the result | |
func addTwoNumbers(a int, b int) { | |
// sleep for a second to simulate a long running operation | |
time.Sleep(2 * time.Second) | |
log.Println("Result:", a+b) | |
} | |
// main is the entry point for the program | |
func main() { | |
// call addTwoNumbers with two numbers | |
addTwoNumbers(1, 2) | |
log.Println("Done") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment