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

What is the difference in return value between then (yield_self) and tap when the block returns a different object than the receiver?

a = 5.then { |x| x + 1 } b = 5.tap { |x| x + 1 } p [a, b]