Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Range#min

rng.min → obj
rng.min {| a,b | block } → obj
rng.min(n) → array
rng.min(n) {| a,b | block } → array

Returns the minimum value in the range. Returns nil if the begin value of the range is larger than the end value. Returns nil if the begin value of an exclusive range is equal to the end value.

Can be given an optional block to override the default comparison method a <=> b.

Example
(10..20).min    #=> 10
See also #member? #minmax #max #size also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1