How to hand in a closure variable

Steve Teale steve.teale at britseyeview.com
Mon Apr 7 11:47:12 PDT 2014


On Friday, 4 April 2014 at 15:15:55 UTC, bearophile wrote:
> Bienlein:
>
>> What I was actually looking for was how to get this to work:
>>
>> immutable int b = if(1 == 1) { return 123; } else { return 
>> 456; };
>
> immutable b = (1 == 1) ? 123 : 456;
>
> Bye,
> bearophile

You said you did not like ternary expressions ;=)

Steve


More information about the Digitalmars-d-learn mailing list