So, I have x variable names I want to assign to x consecutive non-nil values from a method… how can I do that?
For example, I want to map %w[alpha beta gamma] to the three consecutive non-nil values of the function get(x) beginning with 0.
So, say the values of get(x) are get(0)=1, get(1)=54, get(2)=nil, get(3)=6. I’d want alpha = 1, beta = 54, and gamma = 6.
How can I do this?
Setting Hash key/value pairs may not really answer the question but it’s almost always the right solution for a real program …