Chapter 10. While you’re doing that...

This chapter covers

  • The while control statement
  • The switch statement
  • Writing a “How many fingers am I holding up?” app

You learned all about the if statement and how it can help control the flow of your application in chapter 9. The if statement allows you to evaluate variables and then execute different code depending on the outcome of the evaluation. Now you know two ways to control the flow: by the user interacting with your app (by tapping a button, for instance) and by the if statement.

There are a lot of other ways to control the flow of your app, though. I’m going to introduce you to a few more now. This chapter will talk about the while statement and the switch statement, and you’ll write ...

Get Anyone Can Create an App: Beginning iPhone and iPad programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.