jastrachan | 22 Apr 11:50 2004
Picon

Re: Lang request: ||= operator


On 22 Apr 2004, at 09:40, Chris Poirier wrote:
> Hi James,
>
>> This is quite neat. I think someone (sorry can't remember who it was,
>> Chris? Yuri?) made a similar suggestion a while back for something 
>> like
>> this - I think using ?= to be like the ternary operator.
>>
>>   (y != null) ? y : "default"
>
> ?:, not ?=
>
>    y = x ?: "default"

Neat - it basically allows the first value to be optional.

y = x ? x : "default"

y = x ?: "default"

James
-------
http://radio.weblogs.com/0112098/

Gmane