• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Controlling Information Flow > Providing Alternatives to Conditions

Providing Alternatives to Conditions

In many cases, you’ll need to provide an alternative response to the conditional statement. The else statement lets you create consequences when the condition in the if statement is false. The else statement was introduced in Chapter 7 as the way to detect dropped movie clips. In that example, the if statement tested whether a movie clip was dropped on another movie clip. When the statement was true, the dropped movie clip disappeared, and when the statement was false, the else statement made the dropped movie clip bounce back to its original position. The else statement takes care of any condition that the if statement doesn’t cover.

The else statement has to be used in conjunction with the if statement and follows the syntax and logic of this hypothetical example:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint