From: Joel VanderWerf Date: 2009-08-27T03:31:23+09:00 Subject: Re: ||= with 1.8 and 1.9 ? Aldric Giacomoni wrote: > Joel VanderWerf wrote: > >> h = Hash.new(0) >> h[1] ||= 2 # this... >> h[3] = h[3] || 4 # is not like this... >> h[5] || h[5] = 6 # but more like this. >> p h # {3=>0} >> > > Hashes have always been a kind of special case, especially when they > have a default value set up :-) We're talking about assignments on plain > variables, which are (I thought) more clear-cut. True. The quirk happens with reader and writer methods as well as hashes (scroll down a bit in the google groups page to see some examples). -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407