Created
April 25, 2014 17:34
-
-
Save aarti/11297253 to your computer and use it in GitHub Desktop.
ruby precedence
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
audience_range_values = [] | |
age_from = nil | |
audience_range_values << age_from || 3 # does not work, returns book.a | |
print audience_range_values | |
audience_range_values = [] | |
# output [nil] | |
audience_range_values << (age_from || 3) | |
print audience_range_values | |
# output [3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment