Swift笔记之操作符
支持大部分C语言的操作符,但是又有不同
- “=” 不返回任何值,避免了和==号混淆
- 提供两个范围操作符(a..<b and a...b)
- 与Java不同,支持操作符重载
其他地方都和Java或者C没什么不一样
特殊地方
支持元素块比较
(1, "zebra") < (2, "apple") // true because 1 is less than 2
(3, "apple") < (3, "bird") // true because 3 is equal to 3, and "apple" is less than "bird"
(4, "dog") == (4, "dog") // true because 4 is equal to 4, and "dog" is equal to "dog"