这是我的示例,为什么第一个代码有效,而第二个代码不起作用???
此代码不起作用
func main() {
type Country int
const (
Egypt Country = iota
Germany
UnitedStates
)
shortcuts := [...]string{Egypt: "EG", Germany: "GER", UnitedStates: "US"}
fmt.Println("Please use one of these [ 'Egypt', 'Germany', 'UnitedStates']")
entery := os.Args[1]
fmt.Printf("The short cut of %v is %v\n", entery, shortcuts[entery])
}
此代码正在运行
func main() {
type Country int
const (
Egypt Country = iota
Germany
UnitedStates
)
shortcuts := [...]string{Egypt: "EG", Germany: "GER", UnitedStates: "US"}
fmt.Println("Please use one of these [ 'Egypt', 'Germany', 'UnitedStates']")
entery := os.Args[1]
fmt.Printf("The short cut of %v is %v\n", entery, shortcuts[Egypt])
}
牛魔王的故事
三国纷争
相关分类