This is a pretty simple problem im working on in Ruby, but im a total noob so I want to learn the most correct solution. I have a list of data with a name and a value. I need to remember all those (obvious answer: hash). But, i also need to remember the order of this data. SO it looks like:
x=1
y=2
z=3
I was thinking about making an array of 1 element hashes:
[0 => {'x' => 1},
1 => {'y' => 2},
2 => {'z' => 3}]
Are hashes the best choice in this situation? Is there some reason they would be slow, or not optimal?