Re: C#'s "Coalesce" Operator
by Anonymous
<pedantry> I don't know about the Python example, but the Ruby example isn't quite accurate. If Ruby's || did exactly the same as C#'s ??, the following expression: x = false; y = true; x || y ... would have the value false (because false is non-nil), rather than its actual value: true. In Ruby, nil and false evaluate to "false" in a Boolean context and anything else is "true". The || operator tests for "falseness", not "nilness". </pedantry>
Post comment:
Format Type: 
  Convert newlines
  Receive comment notifications for this article
Subject: 
   
insert bold tagsinsert italic tagsinsert underline tagsinsert strikethough tagsinsert linkinsert blockquote tags
Comment: 
Comment verification:

Please enter the text you see inside the graphic to post your comment:
You are not currently logged in. If you would like your user information to be displayed with your comment, please enter your login information below.
Login information:
Username: 
Password: 
If you would like to post contact information on your comment, please enter your information into the optional fields below:
Contact information:
Name: 
URL:  example: http://yourdomain.com
Email: 
Please note: email will not be displayed on the site, only for the blog owner. If logged in, URL will only be used.