hsh.store(key, value) â value
Instance Public methods
Element Assignment
Associates the value given by value
with the key given by
key
.
1 2 3 4 | h = { "a" => 100 , "b" => 200 } h[ "a" ] = 9 h[ "c" ] = 4 h #=> {"a"=>9, "b"=>200, "c"=>4} |
key
should not have its value changed while it is in use as a
key (an unfrozen String
passed as a key will be duplicated and
frozen).
1 2 3 4 5 | a = "a" b = "b" .freeze h = { a => 100 , b => 200 } h.key( 100 ).equal? a #=> false h.key( 200 ).equal? b #=> true |
Please login to continue.