Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Swift iOS Programming for Kids

You're reading from   Swift iOS Programming for Kids Help your kids build simple and engaging applications with Swift 3.0

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher Packt
ISBN-13 9781787120747
Length 260 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Steffen D. Sommer Steffen D. Sommer
Author Profile Icon Steffen D. Sommer
Steffen D. Sommer
Jim Campagno Jim Campagno
Author Profile Icon Jim Campagno
Jim Campagno
Arrow right icon
View More author details
Toc

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 1What 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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime