Created
January 5, 2012 12:39
-
-
Save kzar/1565088 to your computer and use it in GitHub Desktop.
Ruby &&= operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby-1.9.2-p0 :001 > a = nil | |
| => nil | |
| ruby-1.9.2-p0 :002 > a = (a and nil) | |
| => nil | |
| ruby-1.9.2-p0 :003 > a = nil | |
| => nil | |
| ruby-1.9.2-p0 :004 > a = (a and 1) | |
| => nil | |
| ruby-1.9.2-p0 :005 > a = 1 | |
| => 1 | |
| ruby-1.9.2-p0 :006 > a = (a and nil) | |
| => nil | |
| ruby-1.9.2-p0 :007 > a = 1 | |
| => 1 | |
| ruby-1.9.2-p0 :008 > a = (a and 1) | |
| => 1 | |
| ruby-1.9.2-p0 :009 > a = nil | |
| => nil | |
| ruby-1.9.2-p0 :010 > a &&= nil | |
| => nil | |
| ruby-1.9.2-p0 :011 > a = nil | |
| => nil | |
| ruby-1.9.2-p0 :012 > a &&= 1 | |
| => nil | |
| ruby-1.9.2-p0 :013 > a = 1 | |
| => 1 | |
| ruby-1.9.2-p0 :014 > a &&= nil | |
| => nil | |
| ruby-1.9.2-p0 :015 > a = 1 | |
| => 1 | |
| ruby-1.9.2-p0 :016 > a &&= 1 | |
| => 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment