Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chrisbloom7/329281 to your computer and use it in GitHub Desktop.
Save chrisbloom7/329281 to your computer and use it in GitHub Desktop.
The hardest thing for me to grok in Ruby
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"]