标签:
//: Playground - noun: a place where people can play import UIKit // 无参无返回 // -> Void可以省略不写, 或者写成(), 因为返回值为空本质是一个空的元组 func run() -> Void // () { print("I‘m running") } run() // 无参有返回 func sayWelcome() -> String { return "Welcome to play Swift!" } print(sayWelcome()) // 有参有返回 func sayHello(name:String?) -> String { let result = "Hello," + (name ?? "Guest") + "!" return result } var nickName:String? print(sayHello(nickName))
标签:
原文地址:http://www.cnblogs.com/Rinpe/p/5053061.html