Why might you use Hash#fetch over Hash#[] when querying values in a hash?

Technology CommunityCategory: RubyWhy might you use Hash#fetch over Hash#[] when querying values in a hash?
VietMX Staff asked 3 years ago

Hash#fetch provides options for handling the case where a key does not exist in the hash.