In the last chapter, we went through the basics of understanding data types and how to create variables and constants. Now that we are comfortable with those topics, let's look at adding more building blocks. This chapter will build on what we learned in the last chapter and get a bit closer to better understanding Swift.
The following will be covered in this chapter:
- Type safety and type inference
- Operations with Integers
if
statements- Optionals and optional bindings
- Functions
Data types are good, but we will need to add some logic to our app. For example, we want to be able to control whether someone should see a login screen when they launch the app or if they should go right into the app. You will use logic a lot, so let's look at what an if
statement is and how to use it.