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
Share this Page URL
Help

Chapter 2. Understanding Basic Syntax > Working with Statements and Expressions

2.1. Working with Statements and Expressions

All Objective-C programs are made up of statements and expressions. Statements are lines of code that exist strictly for the purposes of executing an action. Generally speaking, statements do not have return values, and so therefore do not change the state of the current line of execution except in ways that are side effects of calling the statement. In other words, the statement can branch into another line of code, and in that other line of code it can cause things to occur that have side effects (such as printing something to the console or displaying a dialog box), but it does not return a value to the current line of code that the statement is in.

Expressions, on the other hand, do return a value to the calling code, and therefore can be used to change program flow.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint