Waldemar Horwat (2013-12-03T01:55:36.000Z)
On 11/29/2013 08:29 AM, Nick Krempel wrote:
> Couldn't find anything on this in the archives, but is there a proposal for:
>
> if (let var = expr) {
>    // var in scope
> }
> else {
>    // var in scope
> }
> // var out of scope

I frequently use the C++ equivalent of this.  Haven't proposed it as part of the scoping upgrades just to keep things small, but I don't have any good reason not to do something like this either.  It kind of falls in the same bucket as &&=, ||=, and ^^.

     Waldemar
domenic at domenicdenicola.com (2013-12-10T01:41:08.449Z)
On 11/29/2013 08:29 AM, Nick Krempel wrote:
> Couldn't find anything on this in the archives, but is there a proposal for:
>
> ```js
> if (let var = expr) {
>    // var in scope
> }
> else {
>    // var in scope
> }
> // var out of scope
> ```

I frequently use the C++ equivalent of this.  Haven't proposed it as part of the scoping upgrades just to keep things small, but I don't have any good reason not to do something like this either.  It kind of falls in the same bucket as `&&=`, `||=`, and `^^`.