It is a significant frustration for me, actually.

 

What I do is to leave out the test completely at the top and put it at the 
bottom , Just as you show. Comes up often in linked-list traversal and math 
code.

 

From: <golang-nuts@googlegroups.com> on behalf of Jonathan <jtc...@gmail.com>
Date: Friday, October 7, 2016 at 4:44 PM
To: golang-nuts <golang-nuts@googlegroups.com>
Cc: <xiiop...@gmail.com>
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:02 PM UTC-4, xiio...@gmail.com wrote:

Any suggestions on a way to write a repeat until loop equivalent in golang that 
looks tidy

 

currently I do :

    ib := true

    for i := a.X; i != b.X || ib; i = i + b.X - a.X {

         ib = false

         //stuff

    }

 

for loops that need to be executed once under all conditions..

 

maybe there's neater or better way ?

 

 

 

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


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