Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

if Statements

As noted in Chapter 3, “An Introduction to Object-Oriented Programming,” Objective-C defines its own Boolean type, BOOL, and the constants YES and NO to represent true and false. A message expression that returns a BOOL can go into the condition part of an if statement, as shown here:

NSArray *employeeNames = ...
NSString* nameOne = @"Ralph";

if ( [employeeNames containsObject: nameOne] )
  {
    ...
  }


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial