Skip to content

Instantly share code, notes, and snippets.

@hedgeye-bnovak
hedgeye-bnovak / gist:6afb75c0cf55649888f77e269028c19e
Last active January 30, 2024 20:34
Nested Hashes - Print Keys
Given the following hash
h = {a: 1, b1: {b2: {b3: nil}, c2: nil}, c1: {c2: {c3: nil}}}
Write a function that prints out all the keys, in order of their keys (not alphabetical order)
i.e. a, b1, b2, b3, c2, c1, c2, c3