标签:go
fallthrough用于强制执行下一个case语句
package main
import "fmt"
func main() {
a := 4
switch a {
case 1:
fmt.Print("123")
case 2, 3, 4:
fmt.Print("456")
fallthrough
default:
fmt.Print("789")
}
}
输出456789
本文出自 “dba天空” 博客,请务必保留此出处http://9425473.blog.51cto.com/9415473/1745730
标签:go
原文地址:http://9425473.blog.51cto.com/9415473/1745730