{}.fetch(:a) { 0 }
=> 0
I think it’s really beautiful. Oh, and it’s Ruby, btw.
Update: this is even better:
{}.fetch(:a) { {} }
=> {}
{}.fetch(:a) { 0 }
=> 0
I think it’s really beautiful. Oh, and it’s Ruby, btw.
Update: this is even better:
{}.fetch(:a) { {} }
=> {}