initial commit
This commit is contained in:
commit
493ce92e02
62 changed files with 1213 additions and 0 deletions
18
multi-return-values/mrv.go
Normal file
18
multi-return-values/mrv.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
//the (int,int) in the func sig shows that the func returns 2 ints
|
||||
func vals()(int,int){
|
||||
return 3,7
|
||||
}
|
||||
|
||||
func main(){
|
||||
//here we use the 2 different values from the call with multiple assignment
|
||||
a,b := vals()
|
||||
fmt.Println(a)
|
||||
fmt.Println(b)
|
||||
//if you only want a subset of the returned values use the blank identifier
|
||||
_,c := vals()
|
||||
fmt.Println(c)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue