Created
November 2, 2015 02:40
-
-
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
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
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