It's not really, it is just syntactic sugar. I just happen to think that this kind of loop is common enough to have dedicated syntax. Not necessarily the syntax I used in my example (that has its issues), but something similar.
Your example it is how I do it myself currently :) On Friday, March 3, 2017 at 6:00:46 PM UTC-5, peterGo wrote: > > milo, > > How is your loop different from this? > > for { > // <loop body actions> > if condition { > break > } > } > > Peter > > On Friday, March 3, 2017 at 5:00:41 PM UTC-5, milo.chr...@gmail.com wrote: >> >> I rather like Go's loops, they are simple and easy to remember, and the >> problem so many languages have with dozens of different loop keywords is >> neatly avoided. Too many loop types is simply a pain, but I think that one >> more wouldn't hurt... >> >> Basically the following would be helpful in some cases without being too >> "odd" compared to what is existing: >> >> do{ >> // <loop body actions> >> }for condition >> >> Is this a good idea? Why or why not? Anyone else have a better idea for >> the syntax? (depending on how you look at it either "do" or "for" is >> redundant, but removing "do" would probably require too much lookahead) >> > -- 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.