7stud2
(7stud --)
1
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
···
--
Posted via http://www.ruby-forum.com/.
7stud2
(7stud --)
2
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}
···
--
Posted via http://www.ruby-forum.com/.