From: oinkoink+unet@... (Bret Jolly) Date: 2002-11-15T09:01:26+09:00 Subject: Syntactic Sugar Question Ruby has the nifty syntactic sugar by which foo ||= "oink" will set foo to "oink" if foo is uninitialized (or nil or false), but will leave foo alone otherwise. I like this, but how the heck does it work? This is evidently syntax sugar for foo = (foo || "oink") which works the same way. But if foo is uninitialized, the expression foo || "oink" gives an error message like NameError: undefined local variable or method `foo' for # To add to the mystery, foo ||= false unless not foo sets foo to nil (not to false)! I'm a confused piggy. Regards, Bret http://www.rexx.com/~oinkoink