Created
June 16, 2011 05:12
-
-
Save michaelfairley/1028707 to your computer and use it in GitHub Desktop.
or vs. || and and vs. &&
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
a = nil || 1 | |
puts a # prints 1 | |
b = nil or 1 | |
puts b # prints nil | |
c = 1 && 2 | |
puts c # prints 2 | |
d = 1 and 2 | |
puts d # prints 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment