Go语言基础 —— (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学习者共勉
                        
«
——张人杰·www.v-signon.com学习者共勉
返回上一页
备案号:京ICP备19038994号-2
个人作品网站:www.up-task.com 主办:个人 English
免责声明:本网站3d地球模型购买自3d.3d66.com,如权利人发现存在误传其作品情形,请及时与本站联系。
网站内容如有侵权,请联系删除:1307776259@qq.com