how can I do in Ruby an array with indexes?
My custom from PHP is something like this:
@my_array = [0 => “a”, 3 => “bb”, 7 => “ccc”]
And this array I want to go through each_with_index and I would like to get the result, e.g. in a shape:
0 - a
3 - bb
7 - ccc
Can anyone help me, how to do?
Thanks
They’re called hashes in ruby.
Reference with a bunch of examples here:
Hash.