go 的fallthrough特征

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了go 的fallthrough特征相关的知识,希望对你有一定的参考价值。

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 的fallthrough特征的主要内容,如果未能解决你的问题,请参考以下文章

go through

一分钟学个词|Go through the roof

across cross through pass的区别

[2016-05-23]OMG美语笔记-Do you miss your family after the new year?Are you going through withdrawal?

go语言的主要特征

go语言的主要特征