Quantcast
Channel: Ruby how to add an element to element to hash that returns hash? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Ruby how to add an element to element to hash that returns hash?

$
0
0

I'm trying to be really efficient with # of lines of code so I want to combine the following two lines of code:

my_hash["X"] = valuemy_hash

If I take out the second line, then my function returns the wrong thing because it will only return the one element of the hash. Is there any way to add the element to the hash that will return the whole hash? Thanks in advance!


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images