On Wed, 19 Oct 2016 18:47:03 +0300
Konstantin Khomoutov <flatw...@users.sourceforge.net> wrote:

[...]
> > Please, can you explain the follwing output:
[...]
> In addition to what Ian said, the way to understand how this works,
> is to compare it with how it works in C.  In C, where the "classic"
> switch was implemented (and then copied to many different languages),
> branches of this statement felt through by default -- unless an
> explicit "break" statement was terminating a branch.
> 
> The idea behind that approach supposedly was to implement a single
> "wall of code" with several entry points into it -- the branches.
> Once the control flow enters that wall of code, it executes to its
> end.
[...]

For more fun regarding the C's switch statement, you can also consider
reading [1] which makes explicit use of the fallthrough-by-default
behaviour (plus more weirdness).

1. https://en.wikipedia.org/wiki/Duff%27s_device

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