A
Anukul Singhal
Hi,
I am facing the following problem, when using the following code
snippet:
c = []
c.push({:name => 'xyz', :class => 'm70', :title => 'yes'})
Now, puts c gives me the output as classm70namexyztitleyes
My Aim is to access the :name attribute of the hash table that is being
pushed into the c array. I tried the following:
puts c[:name] , gives an error - p046hashes.rb:10:in `[]': Symbol as
array index (TypeError)
from p046hashes.rb:10
Can anyone help as to how I can access the value of the hash table
defined in the array?
Thanks,
Anukul
I am facing the following problem, when using the following code
snippet:
c = []
c.push({:name => 'xyz', :class => 'm70', :title => 'yes'})
Now, puts c gives me the output as classm70namexyztitleyes
My Aim is to access the :name attribute of the hash table that is being
pushed into the c array. I tried the following:
puts c[:name] , gives an error - p046hashes.rb:10:in `[]': Symbol as
array index (TypeError)
from p046hashes.rb:10
Can anyone help as to how I can access the value of the hash table
defined in the array?
Thanks,
Anukul