Created
April 20, 2011 13:43
-
-
Save phoet/931361 to your computer and use it in GitHub Desktop.
<< vs. += execution in different context
This file contains 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
class StrangeOperatorBehavior | |
def doit | |
some_array << [3,4] # ok | |
some_array += [6,7] # nil | |
end | |
def some_array | |
@some_array ||= [] | |
end | |
end | |
puts StrangeOperatorBehavior.new.doit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment