Use break statements to exit the switch statement after executing the actions under the matching case. : break « Statement « Flash / Flex / ActionScript






Use break statements to exit the switch statement after executing the actions under the matching case.

 
    

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
 
        var animalName:String = "dove";
        
        switch (animalName) {
          case "turtle":
            trace("Yay! 'Turtle' .");
            break;
          case "dove":
            trace("Sorry, .");
            break;
          default:
            trace("Sorry, try again.");
        }

    }
  }
}

        








Related examples in the same category

1.Using break and continue in Statement Blocks