Loop through each of the elements of the arrays and compare them : Compare : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Compare »

 

Loop through each of the elements of the arrays and compare them


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var letters1:Array = ["a""b""c""d"];
        var letters2:Array = ["a""b""c""d"];
        var equivalent:Boolean = true;
        for(var i:int 0; i < letters1.length; i++) {
            if(letters1[i!= letters2[i]) {
                equivalent = false;
                break;
            }
        }
        trace(equivalent);  // Displays: true
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» Compare