變數函數:
func hello(name:String, word:String, time:Int) -> String {
return "\(name) says \(word) at \(time) oclock."
}
var good1: (String, String, Int)->String
good1 = hello
good1("John", "How are you?", 12)
var good2: (String, String, Int) -> String
good2 = good1
good2("Tome","Good day!", 9)
將第一個變數的值指給第二個變數一樣有效。 |