Skip to content

Instantly share code, notes, and snippets.

Created November 2, 2015 02:40
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 anonymous/063ec227986240405b51 to your computer and use it in GitHub Desktop.
Save anonymous/063ec227986240405b51 to your computer and use it in GitHub Desktop.
The hash value changes even though I didnt save a return value, but the variable will not keep its changed value, I would have to return it explicity and save it into name
def hash_change(hash, make, model)
hash[make] = model
end
hash = {}
hash_change(hash, "Ford", "Mustang")
puts hash
def variable_change(name, new_name)
name = new_name
end
name = "Bob"
variable_change(name, "Todd")
puts name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment