How to hand in a closure variable

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Fri Apr 4 12:56:12 PDT 2014


On Friday, 4 April 2014 at 15:13:25 UTC, Bienlein wrote:
> What I was actually looking for was how to get this to work:
>
> immutable int b = if(1 == 1) { return 123; } else { return 456; 
> };
>
> But I'm happy enough with the solution through a delegate.

What bearophile said, or:

immutable int b = {if(1 == 1) { return 123; } else { return 456; 
}}();


More information about the Digitalmars-d-learn mailing list