- 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
推薦閱讀
- 數據庫基礎與應用:Access 2010
- 從0到1:數據分析師養成寶典
- Voice Application Development for Android
- Effective Amazon Machine Learning
- Hadoop大數據實戰權威指南(第2版)
- 數據庫技術及應用教程
- Hands-On Mathematics for Deep Learning
- Oracle數據庫管理、開發與實踐
- 聯動Oracle:設計思想、架構實現與AWR報告
- Doris實時數倉實戰
- AndEngine for Android Game Development Cookbook
- 智能與數據重構世界
- 一類智能優化算法的改進及應用研究
- 代碼的未來
- 數據挖掘與數據化運營實戰:思路、方法、技巧與應用