On Tue, Mar 18, 2008 at 03:09:56PM +0900, Subbu wrote:
> I came across &&= while reading some code. I know what ||= does but
> not this one. Can someone explain what it does?

The other answers are not wrong, but they may not be clear.

Just as ||= sets the value of something if it doesn't already have one,
&&= sets the value of something if it *does* already have one.

  irb(main):001:0> a = nil
  => nil
  irb(main):002:0> b = 'foo'
  => "foo"
  irb(main):003:0> a &&= b
  => nil
  irb(main):004:0> a = 'foo'
  => "foo"
  irb(main):005:0> b = 'bar'
  => "bar"
  irb(main):006:0> a &&= b
  => "bar"

Is that clear enough?

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
McCloctnick the Lucid: "The first rule of magic is simple. Don't waste your
time waving your hands and hopping when a rock or a club will do."