Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyRubyhashes literals and fetchSingle-choice MCQ

fetch can take a block that runs only when the key is missing. What does this print?

h = { a: 1 } p h.fetch(:b) { |k| "missing #{k}" }