R
ralf
Hi,
I'm tryin some hash functionality and came accros this in irb:
hash = Hash.new("")
=> {}
hash["a"] << "b"
=> "b"
hash["a"]
=> "b"
hash
=> {}
hash.size
=> 0
hash["alskj"]
=> "b"
What ist this? Prog.Ruby says, that by "hash = Hash.new("")" hash has a
default value for missing keys.
How can I set a value for a keys with the <<-method?
Thanks in advance
Ralf
I'm tryin some hash functionality and came accros this in irb:
hash = Hash.new("")
=> {}
hash["a"] << "b"
=> "b"
hash["a"]
=> "b"
hash
=> {}
hash.size
=> 0
hash["alskj"]
=> "b"
What ist this? Prog.Ruby says, that by "hash = Hash.new("")" hash has a
default value for missing keys.
How can I set a value for a keys with the <<-method?
Thanks in advance
Ralf