Files
  • main.go
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import "fmt"

func main(){ 
	fmt.Println("Select your city?")
	fmt.Println("Delhi")
	fmt.Println("Chicago")
	fmt.Println("Shanghai")
	fmt.Println("Tokyo")
	fmt.Println("Sydney")
	fmt.Println("Paris")
	fmt.Println("Mumbai")	
	var name, nationality string
	fmt.Scanf("%s", &name)
		
	switch name {
		case "Delhi","Mumbai": nationality = "an Indian?"
		case "Chicago": nationality =  "an American?"
		case "Shanghai": nationality =  "a Chinese?"
		case "Tokyo": nationality =  "a Japanese?"
		case "Sydney": nationality = "an Aussie?"
		case "Paris": nationality =  "a French?"		
		default: fmt.Println("Not an alien I guess!")
	}
	if nationality != "" {
	  fmt.Println("Thanks! Are you "+nationality)
	 } else {
	fmt.Println("just kidding :) You're a global citizen. Thanks.")
     }   
}
go version go1.9.4 linux/amd64