Break out of non-loops

J Decker d3ck0r at gmail.com
Fri Oct 27 17:03:14 UTC 2017


On Fri, Oct 27, 2017 at 8:47 AM, Sébastien Doeraene <sjrdoeraene at gmail.com>
wrote:

> This is already possible:
>
> $ node
> > console.log('one'); *foo:* { console.log('two'); *break foo;*
> console.log('three'); }; console.log('four')
> one
> two
> four
>
>
probably just me, but this makes it very unobvious where the break goes
to... I'd rather see as a matter of style

console.log('one'); *do*{ console.log('two'); *break;* console.log('three');
}while(false); console.log('four')


but again; probably just my C basis.

Cheers,
> Sébastien
>
> On Fri, Oct 27, 2017 at 5:40 PM, Sebastian Malton <sebastian at malton.name>
> wrote:
>
>> Something that is very useful that was recently released into Rust was
>> the idea of using a break statement to break out of the current level. This
>> is already the case for loops but in Rust it was extended to all statements
>> encased in {}.
>>
>> This would make some code a lot easier to understand as it can eliminate
>> flag variables
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171027/83237f00/attachment-0001.html>


More information about the es-discuss mailing list