## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

# Confused on the for loop, declaring "i". Want to ensure I am understanding.

So I am trying to understand why dave has used the following when creating a for loop. I think I am just having an issue grasping for loops and the reason why we are using "i", is it just arbitrary to initialize the loop? Dave used below. I was able to do this challenge with if, and else if. I started with a for loop, but got confused half way through.

```for (var i = 0; i < questions.length; i += 1) {
question = questions[i][0];
response = parseInt(prompt(question));
```

If I am getting this correctly, we are

1. creating variable i making it 0
2. checking if i is less than questions array length, it is, so run code below
3. making question equal to questions array index of [i, at the moment 0]"[0]
4. adding 1 to i so it stops after getting to a length longer than the array indexes
5. making answers = questions array index [i, at the moment 0][1]
6. making response = prompt(question)

Then it runs again, increasing i, thus moving the question over one index, the answer over one index, and again. So my understanding is that we use i to start the loop and set to zero, and it allows us to use [i] in place of the actual index number to iterate through each variable in the loop? As i increases, it automatically adjusts the rest of code to that value?
Thanks for help!