On Friday, 4 April 2014 at 13:53:33 UTC, bearophile wrote:

If your D function has one argument, you have to give it one argument, even if it doesn't have a visible name and it's unused.

Ah! Admittedly, I though it's the return type .. So this works
now:

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

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.

Reply via email to