Re: [go-nuts] switch fallthrough as continue

2018-11-27 Thread Michael Jones
Absolutely what I was going to say. On Tue, Nov 27, 2018 at 6:32 AM Robert Engels wrote: > Breaks backwards compatibility as the switch may already be in a for loop > and using continue... > > On Nov 26, 2018, at 11:50 PM, Göcs Jëss wrote: > > We might as well reduce a one rarely used keyword >

Re: [go-nuts] switch fallthrough as continue

2018-11-27 Thread Robert Engels
Breaks backwards compatibility as the switch may already be in a for loop and using continue... > On Nov 26, 2018, at 11:50 PM, Göcs Jëss wrote: > > We might as well reduce a one rarely used keyword > > continue means recommence or resume after interruption by google > > if a continue trigge

[go-nuts] switch fallthrough as continue

2018-11-27 Thread Göcs Jëss
We might as well reduce a one rarely used keyword continue means recommence or resume after interruption *by google* if a continue triggers, the switch, select, or for loop statement *resumes* another case or condition we could do continues inside switch statements switch 1 {case 1: cont

Re: [go-nuts] switch fallthrough

2016-10-19 Thread Pietro Gagliardi
In addition, it just so happens that the break at the end situation is the most common situation for a switch statement. So all Go did was flip the requirements: instead of needing an explicit break to not fall through, have an explicit fallthrough to not break. The Go model of break by default

Re: [go-nuts] switch fallthrough

2016-10-19 Thread Konstantin Khomoutov
On Wed, 19 Oct 2016 18:47:03 +0300 Konstantin Khomoutov 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 the

Re: [go-nuts] switch fallthrough

2016-10-19 Thread Konstantin Khomoutov
On Wed, 19 Oct 2016 06:27:47 -0700 (PDT) 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.Pr

Re: [go-nuts] switch fallthrough

2016-10-19 Thread Ian Lance Taylor
On Wed, Oct 19, 2016 at 6:27 AM, 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

[go-nuts] switch fallthrough

2016-10-19 Thread hannover . post
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") fallthrou