Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyComparable and spaceshipSingle-choice MCQ

A class includes `Comparable` with a working `<=>`. What does `clamp` return here?

class Temp include Comparable attr_reader :deg def initialize(d); @deg = d; end def <=>(o); deg <=> o.deg; end end result = Temp.new(120).clamp(Temp.new(0), Temp.new(100)) puts result.deg