Ruby’s Enumerable class includes minmax, which returns a two element array with the minimum and maximum values of an enumerable.
> [1, 5, 10].minmax
=> [1, 10]
> ['alpha', 'bravo', 'zulu'].minmax
=> ["alpha", "zulu"]
Ruby’s Enumerable class includes minmax, which returns a two element array with the minimum and maximum values of an enumerable.
> [1, 5, 10].minmax
=> [1, 10]
> ['alpha', 'bravo', 'zulu'].minmax
=> ["alpha", "zulu"]
Don’t miss my next essay
Hear from me immediately when I post: no ads, unsubscribe anytime.