WHAT YOU WILL LEARN IN THIS CHAPTER:
In the previous two chapters you learned about the various data types in Swift and how Swift deals with strings and characters. In this chapter, you will learn about the various operators available in Swift. Operators work with the various data types to enable you to make logical decisions, perform arithmetical calculations, as well as change values. Swift supports the following types of operators:
The assignment operator (
=) sets a variable or constant to a value. In Swift, you can create a constant by assigning a value to a constant name as shown here:
let companyName = "Developer Learning Solutions" let factor = 5
You can also create a variable using the assignment operator:
var customerName1 = "Richard"
Besides assigning a value to a variable or constant, you can also assign a variable ...