Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubykeyword arguments and double splatSingle-choice MCQ

In Ruby 3.x, why does the second call raise ArgumentError?

def only_kw(**kw) kw end only_kw(x: 1) # works only_kw({ x: 1 }) # raises ArgumentError