Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use if statements. Please refer to the Discussion section of this recipe for more information about different scenarios under which you might want to use if statements.
We use if statement in our everyday conversations. For instance, you might say “If I get a hold of him, I’ll tell him...” or “I would put the computer to sleep if it didn’t take so long to come back up”. All these statements have a condition. If statements in Objective-C also have a condition. You can even make them more sophisticated, having your app do something if a condition is met and something else if the condition is not met. The basic form of an if statement is: