Andrew is right, but I'll also add that if you really do want fallthrough
semantics, you can use the "fallthrough" keyword:
https://play.golang.com/p/x2gBb905Hj0

Go opts to make the somewhat uncommon case of fallthrough explicit, and the
more common "break" case implicit. A bit surprising for new Go programmers
but it does allow for most switch statements to be quite a bit less verbose.

On Mon, Jun 17, 2019 at 7:35 AM Andrew Klager <[email protected]>
wrote:

> I'm going to guess, based on the "break" statement in the final case, that
> you expect each of the case statements without a break to fall through to
> the nest case. Go does not work like that. By default, each case, whether
> there's any action taken or not, breaks. Take a look at this to accomplish
> what you're probably looking for: https://play.golang.org/p/0aXXjoshOk9
>
> On Mon, Jun 17, 2019 at 9:26 AM <[email protected]> wrote:
>
>> i write example code standard switch statement
>> https://play.golang.org/p/kOplHDBk8Df
>>
>> program exited without print something.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/88c11740-e4a2-43af-8d4f-45c986cc55df%40googlegroups.com
>> <https://groups.google.com/d/msgid/golang-nuts/88c11740-e4a2-43af-8d4f-45c986cc55df%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CABn4WMUt%2BD30_OuKORFnMJL6okHYU5TVHKpX-rEqyyJ_Y15DKw%40mail.gmail.com
> <https://groups.google.com/d/msgid/golang-nuts/CABn4WMUt%2BD30_OuKORFnMJL6okHYU5TVHKpX-rEqyyJ_Y15DKw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA%3DXfu3sj63znKC8YSo6FTnj3-UJPRoOuGqxvGUemCLo4pNjVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to