Created
March 11, 2010 16:09
-
-
Save chrisbloom7/329281 to your computer and use it in GitHub Desktop.
The hardest thing for me to grok in Ruby
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
colors = ["red"] #=> ["red"] | |
colors_2 = colors #=> ["red"] | |
colors_2 << "blue" #=> ["red", "blue"] | |
colors #=> ["red", "blue"] | |
def add_white (original_colors) | |
original_colors << "white" | |
end | |
add_white colors #=> ["red", "blue", "white"] | |
colors_2 #=> ["red", "blue", "white"] |
Author
chrisbloom7
commented
Aug 12, 2020
•
- https://rosettacode.org/wiki/Address_of_a_variable#Ruby
- https://launchschool.com/blog/mutating-and-non-mutating-methods
- https://launchschool.com/blog/references-and-mutability-in-ruby
- http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference
- http://nicholasjohnson.com/ruby/ruby-course/exercises/hashes-and-symbols/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment