> But they're not fully interchangeable,

No, they aren’t.

> for example I can exit a function at any point with a return, but can I exit 
> a block at any point with a break or something?

You can give the block a label, say, `foo` and then exit via `break foo`.

> Also a function returns a value, does a block evaluate to something?

No it doesn’t. David Herman proposed a “do expression” that would be able to do 
so:
http://wiki.ecmascript.org/doku.php?id=strawman:do_expressions

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to