Skip to content

Instantly share code, notes, and snippets.

@mendelB
Last active August 29, 2015 14:26
Show Gist options
  • Save mendelB/3f0a03a9adf0e538de09 to your computer and use it in GitHub Desktop.
Save mendelB/3f0a03a9adf0e538de09 to your computer and use it in GitHub Desktop.
flatiron_school = {:teachers=>[{:name=>"steph"}, {:name=>"uzo"}, {:name=>"blake"}], :students => [{:name => "giancarlo", :grade => 100, :address => "bronx"},{:name => "jamie", :grade => 200, :address => "NJ"}]}
flatiron_school.each_pair do |k, v|
v.each do |e|
e.each_pair do |key, value|
puts value if key == :name
end
end
end
def print_specific_elements(hash, element)
hash.each_pair do |k, v|
v.each do |e|
puts e[element]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment