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.golang.org/p/dVtPVt3oKt
>
> ---
>
> I thought this code will work fine, but didn't, because of "fallthrough 
> statement out of place" error.
> Maybe `fallthrough` statement cannot be used in `if` block even if it's 
> put inside `swicth` block)
>
> So, my question is, which is better measure to solve this.
>
> 1. Use if-else instead of switch
> 2. Use goto (like this: https://play.golang.org/p/TILUCapta6) (I think 
> this should be avoided. I would confise LABEL expression with one case)
> 3. Other (please comment)
>
> Thank you.
>

-- 
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.

Reply via email to