摘要:
函数 Swift 使用func关键字声明函数:1 func greet (name: String, day: String) -> String {2 return "Hello \(name), today is \(day)."3 }4 greet ("Bob", "Tuesday"... 阅读全文
摘要:
概览 Swift 的条件语句包含if和switch,循环语句包含for-in、for、while和do-while,循环/判断条件不需要括号,但循环/判断体(body)必需括号:1 let individualScores = [75, 43, 103, 87, 12]2 var teamScor... 阅读全文
摘要:
Hello, world 类似于脚本语言,下面的代码即是一个完整的 Swift 程序。1 println ("Hello, world")变量与常量 Swift 使用var声明变量,let声明常量。1 var myVariable = 422 myVariable = 503 let myCon... 阅读全文
摘要:
Swift is a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility.Swi... 阅读全文