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 3. Making Decisions > The if-else if Statement

3.5. The if-else if Statement

Writing nested if statements can become unwieldy, as you can see from the previous example. Luckily, a special form of the if statement comes to the rescue and enables you to combine the if with the else on the same line. The general format of the if-else if statement is

if Boolean-expression1 then
    statement
    statement
      ...
else if Boolean-expression2 then
    statement
    statement
       ...


  

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