Break out of non-loops

Andreas Rossberg rossberg at google.com
Fri Oct 27 15:47:42 UTC 2017


That is already supported in JS, for all statements. Even

    label: break label;

is legal in JavaScript, and a convoluted way to write a nop.

On 27 October 2017 at 17:40, 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171027/ea5f514d/attachment.html>


More information about the es-discuss mailing list