swit4.0的基本使用
- Swift的基本数据类型 // 整型: Int, Int8, Int16, Int32, Int64 // 浮点型: Double, Float // 布尔类型: Bool // 字符型: Character // 文本类型: String // 集合类型: Array, Dictionary, Set // 元组: 创建或者传递一组数据 // 可选类型: 用于处理值缺失的情况
// 2. 常量和变量 // 常量 let // 变量 var
// 类型安全与推断 -- swift不用在变量后面加(:变量类型)系统可以自动推断
// 数值字面量
//3、元组--就是把多个值组合成一个复合值,而且可以是不同的类型
//4、可选类型-- 使用可选类型可以处理值缺失的情况
//5、基本运算符 //5.1区间运算符 //5.1.1闭区间运算符 (a...b) -- 定义一个包含从 a到 b所有值的区间,b的值大于 a; 在迭代一个区间的值时非常有用 //5.1.2半闭(开)区间群算符(a..<b) -- 定义一个从 a 到 b 但不包含 b的区间 //5.2空合运算符 ??
//6、字符串
//7、集合类型 //7.1 Array //字典
//控制流 //for循环 //while循环 //repeat while也就是OC中的do while //switch 匹配区间
//9函数
// 10. 闭包