Not sure about others, but i assume the condition part and statement part in a control construct live in the same scope.
That's why you can do `for (let a = 1; a < 2; a++) a;`. And `if (let a = 1) a;` maybe in es7? Why that's not the case for "do while"? Is my mental model wrong? > On Apr 17, 2015, at 11:10 PM, Caitlin Potter <[email protected]> wrote: > > Is there a language where lexically scoped variables declared in a block are > accessible outside of that block? Java, C, C#, rust, Python, etc, will not > let you do this. I’m not sure this is a gotcha for most software developers > >> On Apr 17, 2015, at 10:57 AM, Glen Huang <[email protected]> wrote: >> >> ```js >> do { >> let a = 1; >> } while (a); >> ``` >> is "a" undefined in the while condition? This seems like a gotcha. >> >> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss > _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

