From: Sebastian Hungerecker Date: 2007-11-01T00:20:07+09:00 Subject: Re: Array and ASCII Help needed... Martin DeMello wrote: > On 10/30/07, 7stud -- wrote: > > Nope. What do you think the following will output: > > > > h = Hash.new('hi') > > > > h['a'] = h['a'] || 10 > > puts h['a'] > > > > Now, how about the following? The same output as above? > > > > h['a'] ||= 10 > > puts h['a'] > > Yes, and IRB confirms it (ruby 1.8.6). AFAIK, all the a o= b operators > expand immediately to a = a o b. Not in this case. Try p h instead of puts h['a'] above and you'll see different results. -- Jabber: sepp2k@jabber.org ICQ: 205544826