Hema Gonaboina wrote:
> Hi All,
>             I need to add the hashes is there any way to add
> 
> 
> actually my data is in the given format
> data = [ {"first" => 1 ,"second" =>  2},
>             {"first" => 2 ,"second" =>  3},
>             {"first" => 3 ,"second" =>  4} ]
> 
> I want to acheive it through the loop So,

Perhaps like this :

 data = []
 for k in 1..4 do
 data[k-1] = {"first"=>k , "second"=>k+1}
 end

HTH


-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to