Skip to content

Instantly share code, notes, and snippets.

@stujo
Last active December 19, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stujo/7a112cede8e845f7851c4a74058bb7f0 to your computer and use it in GitHub Desktop.
Save stujo/7a112cede8e845f7851c4a74058bb7f0 to your computer and use it in GitHub Desktop.
Mutable Strings in Ruby
puts "Assign bob = \"bob\""
bob = "bob"
puts "bob_smith is also a bob"
puts "So bob_smith = bob (the variable reference)"
bob_smith = bob
puts "We want to capitalize bob so : bob.capitalize!"
bob.capitalize!
puts "No surprise for bob : #{bob}"
puts "But, is this a suprise to bob_smith? : #{bob_smith}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment