Skip to content

Latest commit

 

History

History
10 lines (8 loc) · 245 Bytes

minmax.md

File metadata and controls

10 lines (8 loc) · 245 Bytes

Minmax

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"]