From: John Merlino Date: 2010-01-18T22:27:27+09:00 Subject: Re: What does ||= represent in this situation? anler hp wrote: > hello, the operator | | = is the same as the typical + =, -= and so > on, why did exist in ruby and not in other languages is because in > ruby any expression returns a value. > here is an example very closed but pretty much less effective in other > language > > a = false; > a || a = c; > > this means, makes a = c only if a is false�, same things happen with > > a ||= c -- equivalent to --> a = a || c (if a is false, the right > side of the || will be evaluated and its value will be returned -this > only happen in ruby-, so c is returned either true or false) > > sorry for my english So if a is true, it is returned. If a is false, c is returned. What if a is undefined? -- Posted via http://www.ruby-forum.com/.