Chapter 2. Introduction to Programming

Programming can be a daunting concept, but it doesn’t have to be. Most programming boils down to some basic math skills. No matter what level of math you have taken in the past, you will now learn the basics to get started. Before you start developing apps, it’s important to understand how the magic happens behind the scenes. In this chapter, you will learn the basics of programming, how virtual objects are created, and some best practices to keep your code neat and clean. After you learn these concepts, you will put your knowledge to work and build your first app.

Learning to program is like learning to ride a bike. At first, the concept seems impossible, and you have no idea how to do it. It’s not that you don’t have the basic skills to ride the bike; it’s that you haven’t used those skills together before now. Programming is teaching your brain to think differently; the basic skills are not different, it’s just a new concept.

Building Blocks

We are going to start to define the basic building blocks of a programming language. These are new concepts, and it is normal to do a double-take while learning them. They might sound foreign at first, but so did riding a bike.

Variables

When you check your bank account balance, it shows the current amount of money you have available. Your bank account may be $100 at the beginning of the month, and $350 on your payday. Since the amount of money in the account varies, the term “account balance” is used to ...

Get Introducing iOS 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.