Files
  • main.go
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package main
import "fmt"
func main() {    
color := make(map[string]string)    

 color["R"] = "Red"    
 color["B"] = "Blue"   
 color["G"] = "Green"    

 fmt.Println("Select a Primary Color: R / B / G")
 var colorCode string
 fmt.Scanf("%s", &colorCode)
 
 if value, isOK := color[colorCode]; isOK {
 fmt.Println("You love " +value) } else {
    fmt.Println("Invalid entry OR Key not found in our record")
   }
} 
go version go1.9.4 linux/amd64