swift使用函数、闭包、枚举

定义函数(参数name,day类型string,返回值->String)

func greet(name: String, day: String) -> String {
return "Hello \(name), today is \(day)."
}
greet("Bob", "Tuesday")

 

func getGasPrices() -> (Double, Double, Double) {
return (3.59, 3.69, 3.79)
}
getGasPrices()

posted @ 2014-06-04 16:54  暖流  阅读(224)  评论(0编辑  收藏  举报