From: darren kirby Date: 2008-04-01T13:15:55+09:00 Subject: Re: assignment if key_exist? in Hash quoth the ara.t.howard: > On Mar 31, 2008, at 9:30 PM, Peņa, Botp wrote: > > foo = some_hash["some_key"] || foo > > that replaces even if the key is set to 'false', 'nil', or if the hash > does not have the key... I don't understand...If the hash key doesn't exist then foo retains its original value. That is the behaviour I require: > foo = "Some String" > h = {} > foo = h["none_such"] || foo => "Some String" > h = {"some_key"=>"some value"} > foo = h["some_key"] || foo => "some value" -d -- darren kirby :: Part of the problem since 1976 :: http://badcomputer.org "...the number of UNIX installations has grown to 10, with more expected..." - Dennis Ritchie and Ken Thompson, June 1972