Home » Swift Arithmetic Operators

Swift Arithmetic Operators

by Online Tutorials Library

Arithmetic Operators

Swift 4 supports the four standard arithmetic operators of all number types:

  • Addition (+) Operator
  • Subtraction (-) Operator
  • Multiplication (*) Operator
  • Division (/) Operator

Swift 4 arithmetic operators don’t allow values to overflow by default (like the arithmetic operators in C and Objective-C language do).

In Swift 4, we can opt in to value overflow behavior by using Swift’s overflow operators (such as a &+ b).

We can also use addition operator for String concatenation:

Next TopicRemainder Operator

You may also like