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

Chapter 9. Controlling Information Flow > Branching Conditional Statements

Branching Conditional Statements

If you have multiple possible conditions and just as many consequences, you need to use more complicated branching conditional statements that a single else statement can’t provide. If you create an interface to a Web site or a game that requires keyboard input, for example, you would want to test which keys are pressed and respond appropriately to each key press. Flash gives you the else if statement, which lets you construct multiple responses, as in the following hypothetical example:

if (sunny) {
   bringSunglasses; 
} else if (raining) {
   bringUmbrella; 
} else if (snowing) {
   bringSkis; 
} 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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