Actually it’s almost the same:
my_key = :name
my_hash = { name: 'Joe', age: 52 }
my_hash[my_key]
#=> "Joe"
solved Ruby hashes, getting a key which programatically changes [closed]
Actually it’s almost the same:
my_key = :name
my_hash = { name: 'Joe', age: 52 }
my_hash[my_key]
#=> "Joe"
solved Ruby hashes, getting a key which programatically changes [closed]