[go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-09 Thread Val
Hi Garry, I like the use of a bool loop variable to show intent. So I added an entry in page Do-while-loop idiom in Go . Cheers Val On Sunday, October 9, 2016 at 5:15:51 AM UTC+2, Gary Scarr wrote: > > > I prefer to show the inte

[go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-08 Thread Gary Scarr
I prefer to show the intent of the bool with something like for done :=false;!done;{ //stuff done = xxx // done = expr in until(expr) } On Friday, October 7, 2016 at 7:25:02 PM UTC-4, xiio...@gmail.com wrote: > > Any suggestions on a way to write a repeat until lo

[go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-08 Thread xiiophen
On Saturday, 8 October 2016 20:19:37 UTC+1, Egon wrote: > > > > In this code you could use empty blocks, e.g.: > > { > i := 0 > loop: > fmt.Println(i) > if i < 10 { > i++ > goto loop > } > } > > or: > > i := 0 > { > loop: > fmt.Println(i) > if i < 10 { > i++ > goto loop > } > } > > or: > > i :=

[go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-08 Thread Egon
On Saturday, 8 October 2016 16:34:33 UTC+3, xiio...@gmail.com wrote: > > If you can stomach GOTO the code : > > i := a > > loop1: //stuff > > //..fmt.Println(i, a, b) > > //stuff > > if i != b { > > i = i + b - a > > goto loop1 > > } > > > should compile to somet

[go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-08 Thread xiiophen
If you can stomach GOTO the code : i := a loop1: //stuff //..fmt.Println(i, a, b) //stuff if i != b { i = i + b - a goto loop1 } should compile to something fairly sane without the extra variables and 'ifs' ..but it lacks local scope, and the indentation

Re: [go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-07 Thread Michael Jones
-nuts Cc: Subject: [go-nuts] Re: tidy way to write a repeat-until in golang for i := a.X;; i = i + b.X - a.X {   //stuff if i != b.x { break } } On Friday, October 7, 2016 at 7:25

[go-nuts] Re: tidy way to write a repeat-until in golang

2016-10-07 Thread Jonathan
for i := a.X;; i = i + b.X - a.X { //stuff if i != b.x { break } } On Friday, October 7, 2016 at 7:25:02 PM UTC-4, xiio...@gmail.com wrote: > > Any suggestions on a way to write a repeat until loo