Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubytap and thenSingle-choice MCQ

Why is `then` commonly used with a safe-navigation-like pattern for nil handling, and what does this print?

config = nil result = config&.then { |c| c.fetch(:port) } || 8080 p result