[Swift]Swift #2

Swift #2

func initUI()
{
    //返り値
    println( getMessage() )
    
    //引数のデフォルト値
    println( getMessageOfJeff() )
    
    //Tuples(タプル)
    let message = (2014,"what are you talking about ?")
    let (year,question) = message
    println( message )
    println( "西暦\(year)" )
    println( "question:\(question)" )
}
func getMessage()->String{
    return "I am a pen."
}
func getMessageOfJeff(message:String="Is this a pen ?")->String{
    return message;
}

override func viewDidLoad() {
    super.viewDidLoad()
    initUI()
}

出力結果

I am a pen.
Is this a pen ?
(2014, what are you talking about ?)
西暦2014
question:what are you talking about ?

参考
The Swift Programming Language: The Basics

Tuples can return multiple values from a function as a single compound value.