We can also iterate over hashes using the .each method. For example, we could do

my_hash.each do |key, value| puts my_hash[key] end

This will print out a list of values from my_hash, each on its own line.



Iterate over the matz hash and print each value to the console using puts.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?