- 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
推薦閱讀
- SQL Server 2012數據庫技術與應用(微課版)
- App+軟件+游戲+網站界面設計教程
- 大數據可視化
- Libgdx Cross/platform Game Development Cookbook
- Lean Mobile App Development
- Mastering Machine Learning with R(Second Edition)
- Scratch 3.0 藝術進階
- 跟老男孩學Linux運維:MySQL入門與提高實踐
- 金融商業算法建模:基于Python和SAS
- Apache Kylin權威指南
- Splunk智能運維實戰
- SAS金融數據挖掘與建模:系統方法與案例解析
- 數據分析師養成寶典
- 菜鳥學SPSS數據分析
- Spring MVC Beginner’s Guide