From: Douglas F Shearer Date: 2007-08-29T08:47:12+09:00 Subject: Re: idiomatic way to assign if not nil? Hi Jay On 29 Aug 2007, at 00:30, Jay Levitt wrote: > a = b if b > > Does that exist in a DRYer form? Best I could come up with just now was: a = b || a > a = 123 => 123 > b = nil => nil > a = b || a => 123 >a => 123 > b = 456 => 456 > a = b || a => 456 > a => 456 Cheers. Douglas F Shearer dougal.s@gmail.com http://douglasfshearer.com