//: Playground - noun: a place where people can play import UIKit //----------运算符的使用--------- //1.赋值运算符 var a = 0 var b = 1 //赋值运算符不返回值,不能用作条件判断 swift安全性的体现 b = a //2.算术运算符 let sum = 9 + 4 let min = 9 - 4 let mul = 9 * 4 let div = 9 / 4 let mod = 9 % 4 //取余运算符可以用于浮点数 let mod2 = 8.0 % 2.5 //自增自减 //一元减运算符 let c = 3 var minusB = -c //3.复合的赋值运算符 var d = 4 d += 5 //c = b += 1 //if b = a { // // //} //4. 比较运算符 //5. 逻辑运算符 var male = false //取非运算符只能用于Bool类型的表达式 if !male { print("她是一个女生") } //6.三目运算符 var isReweeted = true; var fontSize = isReweeted ? 15 : 20 //语法上要求?前面必须有空格