On Sat, Apr 5, 2008 at 12:08 PM, David A. Black <dblack / rubypal.com> wrote:

>  The only time this matters is with hashes that have default values. In
>  every other case, as far as I know, x = x || y also describes what's
>  happening.

Well here's another:

class Foo

   attr_writer :x

   def x
     @x || 1 # !> instance variable @x not initialized
   end

   def inspect
     "Foo(#{@x})" # !> instance variable @x not initialized
   end
end

f = Foo.new
f.x            # => 1
f              # => Foo()
f.x ||= 2
f.x            # => 1
f              # => Foo()
f.x || f.x = 2
f.x            # => 1
f              # => Foo()
f.x = f.x || 2
f.x            # => 1
f              # => Foo(1)


-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/