Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book

Summary

In this hour, we covered a lot of material regarding operators. Most operators are straightforward, but if you don’t understand any, don’t worry; operators are used frequently throughout the book, and you will pick it up by repetition. Logical operators manipulate and/or combine Boolean values true and false. Unary operators act upon a single target, binary operators act upon two targets, and ternary operators compare a Boolean value to execute one of two expressions. Operators can be prefix, postfix, or infix, meaning they can be written immediately in front of an operand, immediately after an operand, or in between two operands, respectively. Most of these types of operators are familiar from other languages.

A set of operators in Swift that are new to some C and Objective-C programmers are range operators. These prove to be powerful for iterating over ranges of values, items in a list, and others. Range operators come in two types: half-closed range operators, which include the first but not the last values given, and closed range operators, which include the first and the last values given. We use these operators multiple times throughout this book.

In the next hour, we discuss collection types including Arrays and Dictionaries. Arrays and Dictionaries are crucial to many apps, in that they keep lists of multiple objects in memory to be used for things such as data sources, data retrieved from networks, or even to store preferences between app launches.

  • + Share This
  • 🔖 Save To Your Account