| 1 | package main |
| 2 | |
| 3 | import "fmt" |
| 4 | |
| 5 | func main() { |
| 6 | users := make(map[string]string) |
| 7 | |
| 8 | v, exists := users["a"] |
| 9 | fmt.Println(v, exists) |
| 10 | |
| 11 | if exists == true { |
| 12 | //if exists { |
| 13 | fmt.Println("exists", v) |
| 14 | } else { |
| 15 | fmt.Println("not exists") |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | // Output: |
| 20 | // false |
| 21 | // not exists |