How the iPhone runs our program
To understand what a function is and how it works, it makes sense to first have a look at how a computer, let's say the iPhone, understands or runs our program. Remember from Chapter 1, What is Programming?, that we can think of the code in our program as a recipe for the iPhone to interpret in order to know how our application should work. The way that an iPhone will read our recipe is to go through it line by line, beginning from the top and moving to the bottom, just as we would normally do with a text, book, or recipe. Maybe you already noted it in our earlier playgrounds that anything we print to the console will be printed in the same order as Xcode reads our code, line by line, from the source editor.
To make it clear, let's revisit our playground from Chapter 3, Say Hello. This was how we left it:
print("Hello World") print("We love Swift programming") print("My favorite ice cream is vanilla")
If you click on the small button with an arrow pointing upwards...