»
(08)选择语句
Go语言中也有switch-case语句块,它的每个case默认都会自动分隔开来,一个case执行完成后如果要继续执行下一个case的内容则需要使用fallthrough语句: var a = "hello" switch a { case "aaa": fmt.Println(11) case "hello": fmt.Println(1) fallthrough //继续下一 case case "world": fmt.Println(2) case "hello world","hello world1","hello world2"://多个case的相同处理 fmt.Println(2) default: fmt.Println(0) } ————www.v-signon.com学习者共勉