renumber again
This commit is contained in:
23
018-returns/returns.go
Normal file
23
018-returns/returns.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// ## Multiple Return Values
|
||||
|
||||
// In Go, a function can return multiple values.
|
||||
// This feature is used often, for example to
|
||||
// return a result and an error from a function.
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
// The `(int, int)` in this signature shows that the
|
||||
// function returns 2 ints.
|
||||
func vals() (int, int) {
|
||||
return 3, 7
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Use the 2 different return values from the call.
|
||||
x, y := vals()
|
||||
fmt.Println(x)
|
||||
fmt.Println(y)
|
||||
}
|
||||
3
018-returns/returns.sh
Normal file
3
018-returns/returns.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
$ go run returns.go
|
||||
3
|
||||
7
|
||||
Reference in New Issue
Block a user