From: Nobuyoshi Nakada Date: 2007-04-27T00:24:14+09:00 Subject: Re: Strange syntax sugar Hi, At Tue, 24 Apr 2007 19:40:06 +0900, aalfred wrote in [ruby-talk:248941]: > > foo = bar if bar # case 1 > > foo ||= bar if bar # case 2 > > > > That's the simplest and cleanest, I think. > > There is a subtelty in the assignment that is hard to see at the first > glance: you *never* assign nil to foo (but assign can false). > So your rewrite is not equivalent. Ruby doesn't distinguish nil and false as boolean, so if ??= were introduced it would not assign false. -- Nobu Nakada