break is a keyword that allows you to stop processing a loop or conditional. : for « Statement « Flash / Flex / ActionScript

Home
Flash / Flex / ActionScript
1.Animation
2.Array
3.Class
4.Data Type
5.Development
6.Function
7.Graphics
8.Language
9.Network
10.Regular Expressions
11.Statement
12.String
13.TextField
14.XML
Flash / Flex / ActionScript » Statement » for 
break is a keyword that allows you to stop processing a loop or conditional.
 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var needle:int 3;
        var haystack: Array = new Array(1,2,3,4,5,6);
        for (var i:int 0; i < haystack.length; i++) {
           if (!(hay == haystack[i])) { 
             continue
           }
           trace("I found the needle!");
           break;
        }
    }
  }
}

        
Related examples in the same category
1.The for Statement
2.Perform more complex initializations and increments by adding additional expressions separated by commas
3.Use a for loop to check whether a string contains the @ character
4.Place two statements in the for statement
5.Nested for loops
6.Use for each loop to go through the array elements
7.Use for loop to loop through the dynamic array
8.Use for statements to loop backward:
9.Use for loop statement to display all elements in an array
10.Use For in loop to display all properties in an object
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.