赋值运算符
1对1赋值;
- var a = 5
- let b = 20
N 对N赋值;
let(x,y) = (1,2)
/
赋值运算符没有返回值:防止误用= 和==
if(a = b){
}
求余运算符(左边的正负一致)--swift支持浮点数的计算;
9%4 // 1
-9%4 //-1
9%-4 //1;
-9%-4 // -1
8%2.5 // 0.5
bool类型
溢出运算符;
Int8.min &-1;
Int8.max &+1;
元素的访问
元组
var point =(x:10 ,y:20)
point.x
point.y
point.0
point.1
let point =(10 ,20)
let person = (20,"jack")
指定类型;
var person:(Int ,string) = (20,"jck")
var person = (20,"jack")
var (_,name) = person//只接受name的属性;