Loop through all keys : each_key « Hash « Ruby






Loop through all keys




zip = { 1 => "A", 2 => "B"}

zip.each_key { |key| print key, " " } 

 

Related examples in the same category

1.each_key method passes only the keys to the block