pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Improve comments of clampBetween:and:

Open Ducasse opened this issue 2 months ago • 1 comments

clampBetween: min and: max
	"Return the receiver if between min and max, else the min or max closest to the receiver."
	"(1 clampBetween: 10 and: 20) >>> 10"
	"(15 clampBetween: 10 and: 20) >>> 15"
	"(25 clampBetween: 10 and: 20) >>> 20"
	
	(self between: min and: max)
		ifTrue: [ ^ self ]
		ifFalse: [ self < min ifTrue: [ ^ min ] ].
	^ max

Ducasse avatar Oct 20 '25 18:10 Ducasse

i want to work on this issue.

vishal2005025 avatar Oct 28 '25 13:10 vishal2005025