On 8/28/07, Jay Levitt <jay / jay.fm> wrote:
> I know I can use "a ||= b" to assign b to a if a is nil.
>
> But what about an equivalent to
>
> a = b if b
a &&= b will almost get you there

if a is not nil or false and b is not nil or false then a = b, but if
a is nil or false and b is not nil or false then a = a. So if you can
guarantee that a will always be truthy then you can do it. I'd stick
to a = b if b for sanity's sake.

>
> Does that exist in a DRYer form?
>
>
>