Flash / Flex / ActionScript/Statement/break — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:14, 26 мая 2010
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.");
}
}
}
}
Using break and continue in Statement Blocks
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var aTitles:Array = ["a", "b", "c"];
for (var i:Number = 0; i < aTitles.length; i++){
if(aTitles[i] == "a") {
trace("Title found.");
break;
}
}
}
}
}