If the following code executed what can be problem?
import UIKit
func MinMax(array: [Int]) -> (min: Int, max: Int)
{
var min = array[0];
var max = array[0];
for val in array[1..<array.count] {
if val< min { min = val }
else if val> max { max = val }
}
return (min, max)
}
Correct Answer: min and max variables should be defined as optional variables
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Swift MCQ Questions