formatting

This commit is contained in:
Mark McGranaghan 2012-09-20 19:54:58 -07:00
parent 37e21909a5
commit 9b91f7eff7
4 changed files with 19 additions and 16 deletions

View File

@ -1,16 +0,0 @@
package main
import "fmt"
func main() {
x := make(map[string]string)
x["here"] = "yep"
if name, ok := x["not here"]; ok {
fmt.Println(name)
} else {
fmt.Println("missing")
}
if name, ok := x["here"]; ok {
fmt.Println(name)
}
}

19
src/18-ok-guards.go Normal file
View File

@ -0,0 +1,19 @@
// Ok Guard
package main
import "fmt"
func main() {
x := make(map[string]string)
x["here"] = "yes"
if name, ok := x["?"]; ok {
fmt.Println(name)
} else {
fmt.Println("miss")
}
if name, ok := x["here"]; ok {
fmt.Println(name)
}
}