On 4 Apr 2008, at 20:11, Belorion wrote:

> It was my understanding that the ||= assignment operator assigned  
> the value
> on the right-hand side if and only if the left hand side did not  
> already
> have a value:

It's probably better to think of x ||= "ruby" as being short hand for  
x = x || "ruby" (which it effectively is) instead of "assign if not  
already having a value". If you do this, then you can see why your  
last example behaves like it does.

Don't forget that there are other similar operators like +=, -= and  
&&= and they all follow the same pattern:

x ?= y
x = x ? y

Where ? is one of -, +, && or ||.

Hope that this helps.