just an idea (!! operator)
Christophe Travert
travert at phare.normalesup.org
Fri Jul 13 07:34:36 PDT 2012
"Roman D. Boiko" , dans le message (digitalmars.D:172259), a écrit :
> On Friday, 13 July 2012 at 13:46:10 UTC, David Nadlinger wrote:
>> I guess that this operator is only really worth it in languages
>> where every type is nullable, though.
>>
>> David
>
> It might mean identity (return the argument unchanged) for value
> types.
It might mean: give me the default I provide as an extra argument:
Example:
car?.driver?.name ?: "anonymous";
rewrites:
car? car.driver? car.driver.name? car.driver.name? car.driver.name
:anonymous
:anonymous
:anonymous
:anonymous
More information about the Digitalmars-d
mailing list