more index work
This commit is contained in:
parent
3474d39dc5
commit
c19a29193e
@ -1,31 +0,0 @@
|
||||
// ## Nesting
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
elements := map[string]map[string]string{
|
||||
"He": map[string]string{
|
||||
"name":"Helium",
|
||||
"state":"gas",
|
||||
},
|
||||
"Li": map[string]string{
|
||||
"name":"Lithium",
|
||||
"state":"solid",
|
||||
},
|
||||
"Be": map[string]string{
|
||||
"name":"Beryllium",
|
||||
"state":"solid",
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Println(elements)
|
||||
fmt.Println()
|
||||
|
||||
li := elements["Li"]
|
||||
fmt.Println(li)
|
||||
fmt.Println()
|
||||
|
||||
fmt.Println(li["name"], li["state"])
|
||||
}
|
@ -16,7 +16,8 @@ func vals() (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Use the 2 different return values from the call.
|
||||
// Use the 2 different return values from the call,
|
||||
// i.e. multiple assignement.
|
||||
x, y := vals()
|
||||
fmt.Println(x)
|
||||
fmt.Println(y)
|
3
015-multiple-return-values/returns.sh
Normal file
3
015-multiple-return-values/returns.sh
Normal file
@ -0,0 +1,3 @@
|
||||
$ go run multiple-return-values.go
|
||||
3
|
||||
7
|
@ -1,3 +0,0 @@
|
||||
$ go run returns.go
|
||||
3
|
||||
7
|
@ -1,4 +1,4 @@
|
||||
$ go run varadic.go
|
||||
$ go run varadic-functions.go
|
||||
[1 2] 3
|
||||
[1 2 3] 6
|
||||
[1 2 3 4] 10
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user