If Statement with Declaration

Olivier FAURE via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 24 01:04:31 PDT 2017


On Friday, 21 July 2017 at 21:32:48 UTC, Andrei Alexandrescu 
wrote:
>
> with (auto r = makeMeARange)
> if (!r.empty)
> with (auto x = r.front)
> {
>    ...
> }
>
>
> Andrei

I'm being real nitpicky, but this in particular just seems like a 
slightly worse way to write

     with (auto r = makeMeARange)
     if (!r.empty)
     {
         auto x = r.front;
         ...
     }

But yeah, it's cool construct that lends itself to pretty neat 
chaining.


More information about the Digitalmars-d mailing list