Swift Operators

Operators are special characters—usually drawn from mathematics—that are used to process evaluations, modify variable values, and combine values. Swift operators break down into categories by the function they perform:

  • Assignment operators
  • Arithmetic operators
  • Comparison operators
  • Logical operators
  • Bitwise operators
  • Nil-coalescing operators
  • Range operators

Refer to the following diagram:

Swift Operators

Swift implements its assignment, arithmetic, comparison, logical, and bitwise operators nearly identically to other C-inspired languages, such as C++, Java, and C#—so your previous experience with these operators will apply directly to Swift programming. ...

Get Beginning Swift now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.