New hash, why does it need a default value?


#1

Hello everyone,

I'm trying to figure out why the lesson requires you to create a new hash "with a default value of 0"

frequencies = Hash.new(0)
why can't it just be
frequencies = Hash.new.
Whats the difference between the two and how is it gonna be useful later?

Thanks everyone for your help
Have a great day !
Cheers


#2

My bad, they explained it in the next lesson;

Then what it means is that the default value does NOT get printed until it gets a key, am I right?

Thanks again and have a great day