I just think that:
for { ... } condition()
would be a useful addition to the language because minimum one run of the
for block is a common need.
Or to avoid any confusion, create a new reserved word:
until condition() { ... }
The lack of explicit minimum one-run in my opinion runs counter to the
goals of Go in that it forces boilerplate like the many variations that
have been described. Only someone who isn't fully familiar with the syntax
of the for statement would think there is any use for a 'while' since for
condition() {} IS a while loop.
On Thursday, 3 May 2018 10:19:39 UTC+3, kortschak wrote:
>
> Yeah, that's not `for {} else {}`. This is spelled
>
> ```
> var done bool
> for condition() {
> done = true
> body()
> }
> if !done {
> outOfBody()
> }
> ```
>
> On Wed, 2018-05-02 at 22:45 -0700, Sokolov Yura wrote:
> >
> > for {
> > Body()
> > if !Condition() {
> > break
> > }
> > }
> >
> > It is thats simple, guys.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.