RosettaCodeData/Task/Associative-array-Creation/Ruby/associative-array-creation-...

5 lines
105 B
Ruby

hash = Hash.new('unknown key')
hash[666] = 'devil'
hash[777] # => 'unknown key'
hash[666] # => 'devil'