remove number for source
This commit is contained in:
22
src/ok-guards/ok-guards.go
Normal file
22
src/ok-guards/ok-guards.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// ## OK Guards
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
// todo: note about use with errors
|
||||
Reference in New Issue
Block a user