Book Image

Swift iOS Programming for Kids

By : D. Sommer, Campagno
Book Image

Swift iOS Programming for Kids

By: D. Sommer, Campagno

Overview of this book

This book starts at the beginning by introducing programming through easy to use examples with the Swift Playgrounds app. Kids are regularly encouraged to explore and play with new concepts to support knowledge acquisition and retention – these newly learned skills can then be used to express their own unique ideas. Children will be shown how to create their first iOS application and build their very own movie night application.
Table of Contents (15 chapters)
2
2. Getting Set Up
10
10. Pokémon Battle
13
13. Space Pizza Delivery

What is a function?


Going back to Chapter 1What is Programming?, you may remember that we defined programming as writing a set of instructions for a computer to execute. A function is a block of reusable code or instructions which generally performs a single specific task. A function abstracts one or more instructions and gives us a reference to that block of instructions. Chapter 4Favorite Things, showed us how to reference values using variables. In this chapter, you will learn that a function is basically a set of instructions or a chunk of code that is grouped together and referenced by a function name.

Let's imagine a real-world example for a moment. When you want to order a pizza, you call your local pizza joint. The people working at the pizza joint will then note down your order, put it into their queue of orders, make the pizza specified in your order and lastly, have it delivered to your address.

Actually, we can model these tasks as multiple functions:

  • A function to receive the...