If Statement with Declaration

Dominikus Dittes Scherkl via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 19 09:55:24 PDT 2017


On Wednesday, 19 July 2017 at 16:49:38 UTC, Jonathan Marler wrote:

> This would automatically make it work with any statement:
>
> with(auto x = 0) if(x)
> {
>    doSomething
> }
>
> with(auto x = 0) while(x)
> {
>    doSomething
> }
>
> Could also do multiple with statements
>
> with(auto x = 0)
> with(auto y = 0)
> if(check(x, y))
> {
>     doSomething
> }

Yes. That's exactly the idea. Only with this synax it's worth it.


More information about the Digitalmars-d mailing list