On Wed, Oct 19, 2016 at 6:27 AM, <hannover.p...@gmail.com> wrote: > Please, can you explain the follwing output: > >>4 > =5 > <4 > > --- > > // Go 1.7.1 > > package main > > import "fmt" > > func main() { > x := 5 > > switch { > case x > 4: > fmt.Println(">4") > fallthrough > case x == 5: > fmt.Println("=5") > fallthrough > case x < 4: > fmt.Println("<4") > } > }
The `fallthrough` statement falls through to the body of the next case. It does not test the case conditional of the next case, it simply falls through. Ian -- 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.