# Quick for looping problem

**URL:** <https://forum.kirupa.com/t/quick-for-looping-problem/245464>\
**Category:** Uncategorized\
**Created:** [November 29, 2007, 10:57pm UTC](https://forum.kirupa.com/t/quick-for-looping-problem/245464 "2007-11-29T22:57:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [November 29, 2007, 10:57pm UTC](https://forum.kirupa.com/t/quick-for-looping-problem/245464/1 "2007-11-29T22:57:58Z")

</div>

I have a 10 question multiple choice quiz. I created an array with the correct answers in it. Each question has 4 radio buttons.

for each group, the data is a,b,c,d and put in groups q1, q2, q3, q4 etc all the way to q10.

Now I am trying to make a loop that checks if they answered them correctly and have this so far:

```php

var answers:Array = new Array("b", "a", "c", "d", "c", "a", "c", "b", "c", "d");

_parent._parent._parent.submit.onRelease = function() {
    var testLength:Number = answers.length;
    for (var i = 1; i <= testLength; i++) {
        var question = i;
        checkScore(question);
    }
};

function checkScore(question:Number) {
    //trace(question);
    if (this["q" + question].selectedData == answers[question]) {
        trace(question + " is correct");
    } else {
        trace(question + " is wrong");
    }
}

```

I am checking this when I hit a button and its tracing out this no matter what I select…

```php

1 is wrong
2 is wrong
3 is wrong
4 is wrong
5 is wrong
6 is wrong
7 is wrong
8 is wrong
9 is wrong
10 is correct

```

any idea what I am doing wrong?
