G
Gilbert Lau
Hi all,
Am new to programming am learning to use ruby to code a program. How do
I add a new value to existing key without overwriting the old value?
Went to documentation, but didn't find anything that can help me.
Searched on google as well and in vain.
Say I have a value of coordinate [i,j] and am using a hash table to
store these coordinates for a specific location. Let's say,
Starbuck => [1,2]
How to I append or add a new coordinate of [1,7] to Starbuck? to become,
Starbuck => [1,2], [1,7]
And able to retrieve each individual coordinates later in array as well.
The idea behind the code is iterate, if new location for Starbuck is
found, add the location in i,j format to key "starbuck".
Thanks a lot for your help.
Am new to programming am learning to use ruby to code a program. How do
I add a new value to existing key without overwriting the old value?
Went to documentation, but didn't find anything that can help me.
Searched on google as well and in vain.
Say I have a value of coordinate [i,j] and am using a hash table to
store these coordinates for a specific location. Let's say,
Starbuck => [1,2]
How to I append or add a new coordinate of [1,7] to Starbuck? to become,
Starbuck => [1,2], [1,7]
And able to retrieve each individual coordinates later in array as well.
The idea behind the code is iterate, if new location for Starbuck is
found, add the location in i,j format to key "starbuck".
Thanks a lot for your help.