Skip to content

Instantly share code, notes, and snippets.

@fresh5447
Last active August 29, 2015 13:56
Show Gist options
  • Save fresh5447/9102084 to your computer and use it in GitHub Desktop.
Save fresh5447/9102084 to your computer and use it in GitHub Desktop.
def hash_to_array(h = {})
a = []
h.each do |word, index|
a << "#{word} is #{index}" #build on the array
end
# h.each {|word, index| a << "#{word} is #{index}" }
a #return the array
end
# {name: "Bob"}
#hash_to_array({name: "Bob"})
# ["name is Bob"]
#hash_to_array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment