formatting
This commit is contained in:
parent
37e21909a5
commit
9b91f7eff7
@ -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
19
src/18-ok-guards.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user