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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.