Minimum, maximum, high, low values in Rails

February 8, 2008

 
No Gravatar

Have an array that needs sorting? Perhaps you have a range of condominiums and you want to know the highest and lowest priced properties? Check it.

1
2
3
4
5
6
7
8
# here's my array
@condo_prices = [1000, 75, 2000, 10000]
 
# returns 75
@condo_prices.min
 
# returns 10000
@condo_prices.max
blog comments powered by Disqus