From: Josselin Date: 2007-01-17T07:25:09+09:00 Subject: Re: where to find info on ||= operator ? On 2007-01-16 14:05:32 +0100, "Martin DeMello" said: > On 1/16/07, Josselin wrote: >> I am using >> >> http://www.ruby-doc.org/docs/ProgrammingRuby/ >> >> a sa reference manual, but could not find info on that operator (how >> to use it..) > > It's syntax sugar: > > foo = bar > > expands to > > foo = foo bar > > So a ||= b expands to a = a || b, which (since || is short-circuiting) > means "set a to b if a is nil (or false), otherwise leave it at its > current value. > > martin thansk Martin.. I can read Carlos' link with a good example ! Joss