Ruby - Hash Hash Iterating

Introduction

With arrays, you can use the each method to iterate through each element of the array.

You can do the same with hashes:

Demo

x = { "a" => 1, "b" => 2 } 
x.each { |key, value| puts "#{key} equals #{value}" }

Result