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

9 lines
164 B
Plaintext

h = [:] #Empty hash
h[:a] = 1 #Assign value
h[:b] = [1 2 3] #Assign another value
h2 = [a: 1, b: [1 2 3], 10 : "ten"] #Initialized hash
h2[:b][2] #Returns 3