Correct.

On Tue, May 1, 2018 at 7:36 AM Alisdair <alisdair.d.macl...@gmail.com>
wrote:

> Isn't `for { ... if cond { break; } }` the same as `do {...} while cond`?
> Whilst having the benefits of not adding new keywords and maintaining the
> logic of the loop entirely within the block of the loop making it simpler
> to understand.
>
> On Tue, 1 May 2018 at 14:56, Michael Jones <michael.jo...@gmail.com>
> wrote:
>
>> Maybe he meant "until" aka "do {...} while cond" -- this is a valuable
>> and missing mechanism. The argument back in the day was that having just
>> one looping construct was more friendly to tooling.
>>
>> On Tue, May 1, 2018 at 5:45 AM Ian Lance Taylor <i...@golang.org> wrote:
>>
>>> On Tue, May 1, 2018 at 4:11 AM, Hugh Fisher <hugo.fis...@gmail.com>
>>> wrote:
>>> >
>>> > Another observation from this novice Go programmer: I'm puzzled why
>>> > there's no while statement.
>>> >
>>> > I know it's possible to use a for, but it doesn't feel right to me. I
>>> always
>>> > think of for loops as for iterating over data structures. Originally
>>> just
>>> > arrays, but languages like Python and Objective-C have extended for
>>> > loops to other collections as well. "Looping until some condition is
>>> met"
>>> > for me is a different control structure and needs a different keyword.
>>> >
>>> > There'd be overlap with the for statement, but if-then-else and switch
>>> > with boolean case overlap too.
>>> >
>>> > And since while has been a reserved keyword in a lot of programming
>>> > languages for many decades, I would bet a reasonable amount of
>>> > money that a while statement could be added to Go right now and not
>>> > break anyone's production code.
>>>
>>> A `while` statement would presumably be exactly identical to a `for`
>>> statement with a single condition.  So adding a `while` statement
>>> would not add any power to the language, and would add an additional
>>> keyword.  All language choices are a cost benefit decision.  In this
>>> case the benefit is a looping construct that some people will find
>>> clearer to read and write, and the cost is a new keyword that
>>> everybody needs to learn, and that at this point in the language's
>>> evolution will likely break some, even if not much, existing code.  I
>>> don't think the benefit is worth the cost.
>>>
>>> Ian
>>>
>>> --
>>> 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.
>>>
>>
>>
>> --
>> Michael T. Jones
>> michael.jo...@gmail.com
>>
>> --
>> 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.
>>
>

-- 
Michael T. Jones
michael.jo...@gmail.com

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