# If() Statement within a for() STUFFING UP!

**URL:** <https://forum.kirupa.com/t/if-statement-within-a-for-stuffing-up/150511>\
**Category:** Uncategorized\
**Created:** [June 8, 2005, 2:25am UTC](https://forum.kirupa.com/t/if-statement-within-a-for-stuffing-up/150511 "2005-06-08T02:25:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [June 8, 2005, 2:25am UTC](https://forum.kirupa.com/t/if-statement-within-a-for-stuffing-up/150511/1 "2005-06-08T02:25:28Z")

</div>

Hi everyone…this problem is really giving me crap…both of these traces -

trace(\_root[“villa\_button”+i].villaStatusID);  
trace(“Status ID = “+eval(“villa\_button”+i+”.villaStatusID”));

they both trace the right value (the value is 2). but when I try to test if the variable is equal to 2 in a for() statement like this

for(i=1; i\<=villaNumberResults; i++){  
[indent]if(**[color=red]\_root[“villa\_button”+i].villaStatusID[/color]** ==2){

trace(“hello”)  
}  
[/indent]}

it doesnt work. Why is that…how can I test equality of my villaStatusID variable for each villa\_button+i?

Thanks in advance.
