I am a novice in Ruby. I want to change the value of hash associated with a particular key. H = Hash["a" => 100, "b" => 200] I want the value associated with a=>300 and this change should be permanent. Please give the methods except hash.[key]=value
on 2013-02-21 10:35
on 2013-02-21 10:44
http://www.ruby-doc.org/core-1.9.3/Hash.html irb(main):001:0> h = {"a" => 100, "b" => 200} => {"a"=>100, "b"=>200} irb(main):002:0> h.store 'a', 300 => 300 irb(main):003:0> h => {"a"=>300, "b"=>200}
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.