Multiple return values
package main
import "fmt"
func main() {
fmt.Println("Hello World")
a, b := calc(3, 2)
fmt.Printf("%v and %v\n", a, b)
}
func calc(a, b int) (int, int) {
return a + b, a - b
}
Hello World
5 and 1
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import "fmt"
func main() {
fmt.Println("Hello World")
a, b := calc(3, 2)
fmt.Printf("%v and %v\n", a, b)
}
func calc(a, b int) (int, int) {
return a + b, a - b
}
Hello World
5 and 1