//函數(shù)func sayAfternoon(personName: String) -> String {? ? let say = "Hello afternoon " + personName + "!"? ? return say}sayAfternoon("王麗媛")//多參量函數(shù)func sayHello(personName: String, isExsit: Bool) {? ? if isExsit {? ? ? ? print ("已經(jīng)說過了")? ? } else {? ? ? ? print ("hello " + personName)? ? }}sayHello("jiawei", isExsit: true)//多重返回值函數(shù)func minMax(array: [Int]) -> (min: Int, max: Int) {? ? var currentMin = array[0]? ? var currentMax = array[0]? ? for value in array[1..currentMax {
currentMax = value
}
}
return (currentMin, currentMax)
}