Posts Tagged: min


8
Feb 08

Minimum, maximum, high, low values in Rails

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.

# here's my array
@condo_prices = [1000, 75, 2000, 10000]

# returns 75
@condo_prices.min

# returns 10000
@condo_prices.max