/** * 打印用print() * */ print("Hello, World!") /** * 声明变量用var * * 声明常量用let */ var myVariable = 42 myVariable = 50 let myConstant = 42 //Swift可以类型推断 let implicitInteger = 70 let implicitDouble = 70.0 let explicitDoule: Double = 70 // 字符串 let label = "The width is " let width = 94 // 字符串与整型常量拼接 let widthLabel = label + String(width) print(widthLabel)
原文:http://www.cnblogs.com/hemac/p/5055315.html