From: Yukihiro Matsumoto Date: 2009-08-27T08:11:51+09:00 Subject: Re: ||= with 1.8 and 1.9 ? Hi, In message "Re: ||= with 1.8 and 1.9 ?" on Thu, 27 Aug 2009 06:23:01 +0900, "David A. Black" writes: |> According the rubyspec project: |> |> language/variables_spec.rb: |> describe "Operator assignment 'var op= expr'" do |> it "is equivalent to 'var = var op expr'" do | |It isn't, though, at least in the ||= case (see Joel W.'s post). |Matz's characterization of it to me at RubyConf (or somewhere) was: | | x ||= y same as x || x = y Basically, "var op= expr" works like "var = var op expr" but left hand side expression (var) is evaluated only once. For ||=, it is same as x = (x || y) but x || (x = y) is semantically same (well, almost). matz.