Skip to Content
Data Structures
Iterating Over a Hash

We’ve done a fair amount of iteration over arrays, so to finish up, let’s review how to iterate over a hash.

numbers = [1, 2, 3, 4, 5] numbers.each { |element| puts element }



Iterate through .each key/value pair in lunch_order.

Please puts out the value of each pair (just the value, not the key).

Folder Icon

Take this course for free

Already have an account?