Ah, I wasn't quite clear on that. That does make them a lot even more useful.
On Monday, 24 September 2018 11:12:38 UTC+2, ohir wrote: > > On Mon, 24 Sep 2018 01:37:56 -0700 (PDT) > Louki Sumirniy <louki.sumir...@gmail.com <javascript:>> wrote: > > > I am quite a fan of switch statements, they can make a list of responses > to > > a change in state very readable and orderly. > > But you have to remember a few things about them. > > > They don't evaluate in any definite order, > > I did not quite follow the whole post but expression switch > **is evaluated in an exact order**: > > [Switch Statements](https://golang.org/ref/spec#Switch_statements) > :: In an expression switch, the switch expression is evaluated and the > case > :: expressions, which need not be constants, are evaluated left-to-right > and > :: top-to-bottom; the first one that equals the switch expression triggers > :: execution of the statements of the associated case; the other cases are > :: skipped. If no case matches and there is a "default" case, its > statements > :: are executed. There can be at most one default case and it may appear > :: anywhere in the "switch" statement. A missing switch expression is > :: equivalent to the boolean value true. > > > -- > Wojciech S. Czarnecki > << ^oo^ >> OHIR-RIPE > -- 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.