How would I create three empty hashes with a single line of code?
I know that a = b = c = Hash.new won’t work, since that’ll create three references to the same Hash object.
a,b,c = Hash.new will assign the Hash to a, but b and c remain nil.
I know I could do a, b, c = Hash.new, Hash.new, Hash.new, but that doesn’t look very DRY.
As I posted as a comment, I think
a, b, c = {}, {}, {}is the best way, because it’s short, and easy to read. If you really want to do it in a more complicated way, something like this will work: