From: Ryan Davis Date: 2010-02-19T17:09:38+09:00 Subject: Re: Ruby conditionals subtlety? On Feb 18, 2010, at 17:48 , Farhad Farzaneh wrote: > Ryan Davis wrote: >> On Feb 18, 2010, at 16:04 , Farhad Farzaneh wrote: >> >>>> yet, and hasn't affected the lookup tables. >>> value. As such, if we're ever going to use defined? as a conditional, >>> it should precede any other mention of the token (foo). >> >> I should also point out: almost all of this is of no consequence. You >> almost never use defined? on a local variable like this. You usually use >> it on a const, ivar, cvar, or global, and all of those are unambiguous. > > Thanks. I sometimes use it in Rails partials rendering, where I may > pass an optional local variable, but if it isn't passed, I want to set > it to some default value. Perhaps there's a better way of doing this... var ||= default