[go-nuts] Re: "fallthrough statement out of place" in `if` block inside `swicth` block

2017-08-04 Thread Fumi Takeuchi
Thanks a lot for your polite and convenient replies. This time, I decided to use nested if-else instead of switch-fallthrough. As all of you mentioned, I have to avoid this. Maybe it's not Go style. What I actually want to write is very little router that determines which to provide converted fi

Re: [go-nuts] Re: "fallthrough statement out of place" in `if` block inside `swicth` block

2017-08-02 Thread Doğan Kurt
In first snippet, i didn't get the second if. cond1 is true anyway. Second snippet is equivalent to if (cond1) { do_stuff() do_other_stuff() } else if cond2 { do_other_stuff() } which is more straightforward than using fallthrough imo. On Wednesday, August 2, 2017 at 9:03:35 AM

Re: [go-nuts] Re: "fallthrough statement out of place" in `if` block inside `swicth` block

2017-08-02 Thread Konstantin Khomoutov
On Tue, Aug 01, 2017 at 05:54:28AM -0700, kultigin@gmail.com wrote: > i believe you should avoid fallthrough statement except for auto-generated > code. > > it's obscure what you are trying to accomplish with that piece of code, but > surely you can do it in a better way. They have its val

[go-nuts] Re: "fallthrough statement out of place" in `if` block inside `swicth` block

2017-08-01 Thread kultigin . tsz
i believe you should avoid fallthrough statement except for auto-generated code. it's obscure what you are trying to accomplish with that piece of code, but surely you can do it in a better way. On Tuesday, August 1, 2017 at 2:35:00 PM UTC+2, Fumi Takeuchi wrote: > > Example code: https://play.