# Help with a looping through arrays

**URL:** <https://forum.kirupa.com/t/help-with-a-looping-through-arrays/255039>\
**Category:** flash\
**Created:** [March 18, 2008, 2:12pm UTC](https://forum.kirupa.com/t/help-with-a-looping-through-arrays/255039 "2008-03-18T14:12:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesHolder](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JamesHolder](https://forum.kirupa.com/u/JamesHolder)\
**Post date:** [March 18, 2008, 2:12pm UTC](https://forum.kirupa.com/t/help-with-a-looping-through-arrays/255039/1 "2008-03-18T14:12:26Z")

</div>

Hi

I am use some code to get feedback for a quiz it check the results array to see if it is true or false and then takes the feedback out of either the posFeedback array of the negfeedback array. however the is just bring back undefined below is the code i am using.

```auto

var results:Array = new Array(true, false, true);
var posFeedback:Array = new Array("bonza", "well done sir", "spot on");
var negFeedback:Array = new Array(" ****", "crap", "pants");
function getFeedbackText():String {
    trace("hit");
    var l:Number = results.length;
    var feedback:String = "";
    for (var i:Number = 0; i<l; i++) {
        var isCorrect:Boolean = results*;
        if (isCorrect) {
            feedback += posFeedback*;
        } else {
            feedback += negFeedback*;
        }
        feedback += "<br><br>";
    }
    return feedback;
}

htmlTextField.text = getFeedBackText();

trace(feedback);
trace (l)

```

thanks

James Holder
