Ruby and Perl do this. IIRC, it started off as a Perl idiom.

On Oct 13, 2006, at 11:58 AM, Ken Snyder wrote:

Is this "defaulting" behavior found in any other languages besides _javascript_?  I tried it in PHP; PHP seems to always return true or false;

--Ken


Brad Ediger wrote:
...
{a: 3} || {}   // ==> {a: 3}
null   || {}   // ==> {}    
null   || 0    // ==> 0     



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to