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 previous chapter and get us a bit closer to understanding Swift better.
The following topics 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 whether 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.