Return an array containing all the keys in a hash with keys: : Hash Keys « Hash « Ruby






Return an array containing all the keys in a hash with keys:


zip = { 1 => "One", 2 => "Two", 3 => "Three",
4 => "Four", 5 => "Five", 6 => "Six", 7 =>
"Seven", 8 => "Eight", 9 => "Eight" }

zip.keys # => [8, 3, 6, 9, 5, 2, 1, 4, 7]

 








Related examples in the same category

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