> > > Maybe `fallthrough` statement cannot be used in `if` block even if it's > put inside `swicth` block) > > True: It may be used only as the final non-empty statement in such a > clause <https://golang.org/ref/spec#Fallthrough_statements>. >
> why to make this restriction? One reason is that an excessively long case statement could hide a control flow modification high up in the code that invisibly modifies the behavior at the end of the case. On Friday, August 4, 2017 at 3:48:40 PM UTC-7, T L wrote: > > > > On Tuesday, August 1, 2017 at 8:41:21 AM UTC-4, Jan Mercl wrote: >> >> On Tue, Aug 1, 2017 at 2:34 PM Fumi Takeuchi <fmodqu...@gmail.com> wrote: >> >> > Example code: https://play.golang.org/p/dVtPVt3oKt >> > >> > Maybe `fallthrough` statement cannot be used in `if` block even if it's >> put inside `swicth` block) >> >> True: It may be used only as the final non-empty statement in such a >> clause <https://golang.org/ref/spec#Fallthrough_statements>. >> > > why to make this restriction? > > And why to make the similar restriction for goto: > > https://golang.org/ref/spec#Goto_statements > "A "goto" statement outside a block cannot jump to a label inside that > block" > > > >> >> > 3. Other (please comment) >> >> https://play.golang.org/p/8rL0zqaLP3 >> >> -- >> >> -j >> > -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.