From: Logan Capaldo Date: 2007-08-29T08:46:29+09:00 Subject: Re: idiomatic way to assign if not nil? On 8/28/07, Jay Levitt 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? > > >