# Undefined values help

**URL:** <https://forum.kirupa.com/t/undefined-values-help/259605>\
**Category:** Uncategorized\
**Created:** [May 7, 2008, 2:21am UTC](https://forum.kirupa.com/t/undefined-values-help/259605 "2008-05-07T02:21:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iMat](https://avatars.discourse-cdn.com/v4/letter/i/bbce88/32.png) [@iMat](https://forum.kirupa.com/u/iMat)\
**Post date:** [May 7, 2008, 2:21am UTC](https://forum.kirupa.com/t/undefined-values-help/259605/1 "2008-05-07T02:21:20Z")

</div>

Help! This should be a simple thing, but I can’t seem to figure it out:

```php

        var curr_index;

        for (var i=0; i<total; i++) { //total is an integer defined elsewhere    
            curr_index.iValue = i;
            trace(i);
            trace("iValue:" + curr_index.iValue);
}

```

Returns this in output when executed:

```php

0
iValue:undefined
1
iValue:1
2
iValue:2
3
iValue:3

```

Why is iValue undefined and not 0? How can I fix this? I know AS2 and FP7+ defaults undeclared variables as NaN or undefined, but I believe it is being set to ‘i’, which should start off as 0.

This is AS2.0 running on FP8 or 9.

Thanks
