The D Scripting Language

Leandro Lucarella luca at llucax.com.ar
Tue Nov 16 06:49:50 PST 2010


Daniel Murphy, el 16 de noviembre a las 10:10 me escribiste:
> "Per Ångström" <d-news at autark.se> wrote in message 
> news:ibr8bs$22mu$1 at digitalmars.com...
> >     return s || "default";
> 
> I think allowing the second expression in the ternary operator to be omitted 
> would be a better fit for D, and provide the same function.
> 
> ie.
> auto x = a ? a : b;
> auto x = a ? : b;
> 
> I think bearophile might have already proposed this? 

Yes, the "elvis operator" ?:

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Sometimes I think the sure sign that life exists elsewhere in the universe
Is that that none of them tried to contact us


More information about the Digitalmars-d mailing list