On Mon, Jan 16, 2012 at 2:14 PM, Herby Vojčík <[email protected]> wrote:
> Thank you, it helped.
>
> It is the fact that in ES up till now, {} block were always delimited by a
> keyword (if/else is probably the only case when two blocks were present). So
> it is not a bad idea to retain it.
I believe it's perfectly valid to write blocks (for no particular
reason) without any keyword.
I.e.:
function foo() {
var x = 42;
{
var y = 10;
print(x+y);
}
return x;
}
Obviously it's useless, but it is valid.
You could add a label to the block if you want to actually use it for something:
bar: {
if (x == 10) { y = 10; break bar; }
if (x == 20) { y = 0; break bar; }
...
}
/L 'Bad examples are bad!'
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss