O'Reilly logo

Transitioning to Swift by Scott Gardner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    4

Performing Operations

This chapter will focus on performing operations, including arithmetic, logical, bitwise, type checking, and type casting. Operator precedence and associativity rules will also be reviewed.

Basic Operators

Swift includes the same basic operators as Objective-C, yet it adheres to a slightly different set of rules for operator precedence and associativity that are intended to be simpler and more predictable. Precedence and associativity will be covered later in this chapter.

The basic operators are implemented in Swift in the same manner as Objective-C, with a few exceptions and additions that will be mentioned next, followed by a summary of all basic operators with examples in Tables 4-1 through 4-4.

In both ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required