more index work

This commit is contained in:
Mark McGranaghan 2012-09-23 14:38:39 -07:00
parent 3474d39dc5
commit c19a29193e
112 changed files with 8 additions and 39 deletions

View File

@ -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"])
}

View File

@ -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)

View File

@ -0,0 +1,3 @@
$ go run multiple-return-values.go
3
7

View File

@ -1,3 +0,0 @@
$ go run returns.go
3
7

View File

@ -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