
上QQ阅读APP看书,第一时间看更新
Comparison operators
Swift's comparison operators are also derived from C; the reader will doubtless recognize them immediately:
if x == 0 {print("x is equal to zero")}
if x != 0 {print("x is not equal to zero")}
if x < 0 {print("x is less than zero")}
if x > 0 {print("x is more than zero")}
if x <= 0 {print("x is less than or equal to zero")}
if x >= 0 {print("x is more than or equal to zero")}