- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 164字
- 2021-07-02 23:54:24
Basic operators
Swift provides the following basic operations:
- The = operator for assignments, similar to many different programming languages.
- The + operator for addition, - for subtraction, * for multiplication, / for pision, and % for remainders. These operators are functions that can be passed to other functions.
- The -i operator for unary minus and +i for unary plus operations.
- The +=, -=, and *= operators for compound assignments.
- The a == b operator for equality, a != b for inequality, and a>b, a<b, and a<=b for greatness comparison.
- The ternary conditional operator, question ? answer1: answer2.
- nil coalescing a ?? b unwraps optional a if it has a value and returns a default value b if a is nil.
- Range operators:
- Closed range (a...b) includes the values a and b
- Half-open range (a..<b) includes a but does not include b
- Logical operators:
-
- The !a operator is NOT a
- The a && b operator is logical AND
- The a || b operator is logical OR
推薦閱讀
- MySQL高可用解決方案:從主從復制到InnoDB Cluster架構
- Voice Application Development for Android
- Redis應用實例
- Python數據分析、挖掘與可視化從入門到精通
- 圖解機器學習算法
- Microsoft Power BI數據可視化與數據分析
- 信息學競賽寶典:數據結構基礎
- 數據庫原理與應用
- INSTANT Android Fragmentation Management How-to
- Hadoop集群與安全
- 計算機組裝與維護(微課版)
- Web Services Testing with soapUI
- Oracle 11g+ASP.NET數據庫系統開發案例教程
- 從Lucene到Elasticsearch:全文檢索實戰
- PostgreSQL高可用實戰