Last active
July 20, 2020 03:34
-
-
Save kjk/dd5d25485e5cccff6d1c8c10145a283c to your computer and use it in GitHub Desktop.
Example for https://essential-go.programming-books.io/functions-6464727799a04611a891be7ca4877f8c (made with https://codeeval.dev)
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 "fmt" | |
// :show start | |
func Add(a, b int) int { | |
return a + b | |
} | |
func AddAndMultiply(a, b int) (int, int) { | |
return a + b, a * b | |
} | |
func main() { | |
sum, mult := AddAndMultiply(5, 8) | |
fmt.Printf("5+8=%d\n5*8=%d\n", sum, mult) | |
sum = Add(6, 12) | |
fmt.Printf("6+12=%d\n", sum) | |
} | |
// :show end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment