func minMax(array: [Int]) -> (min: Int, max: Int){
var currentMin = array[0]
var currentMax = array[0]
for value in array[1..<array.count]{
if currentMin > value{
currentMin = value
} else if currentMax < value {
currentMax = value
}
}
return (currentMin, currentMax)
}
let array = [0, 3, 24, 1333]
let result = minMax(array: array)
result.min //0
result.max //1333
result.0 //0
result.1 //1333