What if a key does not exist : Hash Keys « Hash « Ruby






What if a key does not exist


empty = {}
empty["one"]   # nil

 








Related examples in the same category

1.Return an array containing all the keys in a hash with keys:
2.Extract data from the hash by using its keys.
3.Use number as hash key
4.Retrieving Keys
5.Join hash keys together
6.RuntimeError: hash modified during iteration
7.Get all keys from a hash
8.Time value key
9.Searching a Hash with Regular Expressions
10.Hash as a key