# Validating/identifying an "undefined" array element

**URL:** <https://forum.kirupa.com/t/validating-identifying-an-undefined-array-element/244268>\
**Category:** flash\
**Created:** [November 15, 2007, 7:15pm UTC](https://forum.kirupa.com/t/validating-identifying-an-undefined-array-element/244268 "2007-11-15T19:15:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpann](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tpann](https://forum.kirupa.com/u/tpann)\
**Post date:** [November 15, 2007, 7:15pm UTC](https://forum.kirupa.com/t/validating-identifying-an-undefined-array-element/244268/1 "2007-11-15T19:15:33Z")

</div>

I’m passing an array as an argument to a class, like this:

```auto
 
formatArray = [string, number, number,
               string, number, number,
               string, number, number,
               string, number, number,
               string, number, number];

```

The class, which converts the array to \_formatMatrix, is is set up to EXPECT the array to contain 15 elements. In the class, I do this:

```auto

switch (_formatMatrix[12]) {
     // do something
}

```

When I pass formatArray containing only **four** sets of \<string, number, number\> rather than **five** , I get this error:

```auto

Error #2007: Parameter format must be non-null.

```

I have tried adding a conditional to the class that makes it disregard the fifth set thus:

```auto

if (_formatMatrix[12] = null) {
    trace("_formatMatrix[12] is undefined!");
} else {
    // do something
}

```

This doesn’t work – I still get the 2007 error, and I don’t see the trace. Meaning, I never get to the conditional because Flash doesn’t like that I have not included the fifth set. I have also tried…

```auto

if (_formatMatrix[12] = undefined)

```

…but that doesn’t work and I don’t actually know if that’s valid.

What do I need to do to make the class allow me to pass an “incomplete” array?

Thanks!
