# How to write an if statment where an array is empty

**URL:** <https://forum.kirupa.com/t/how-to-write-an-if-statment-where-an-array-is-empty/180038>\
**Category:** Uncategorized\
**Created:** [February 24, 2006, 10:10pm UTC](https://forum.kirupa.com/t/how-to-write-an-if-statment-where-an-array-is-empty/180038 "2006-02-24T22:10:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tattered](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@Tattered](https://forum.kirupa.com/u/Tattered)\
**Post date:** [February 24, 2006, 10:10pm UTC](https://forum.kirupa.com/t/how-to-write-an-if-statment-where-an-array-is-empty/180038/1 "2006-02-24T22:10:31Z")

</div>

Ok I’m trying to write an if statement say that if the array is empty goto frame 1. I’m trying different things for this and I cant seem to get it. The only thing i can get so far is this…

```auto

if(myArray.length = -1){
   _root.gotoAndPlay(1);
   trace(myArray);
}

```

But that doesnt work, cause when you click the button even if the array isnt empty it still takes you to frame 1 :S. Can someone please help me.
