# Basic for loop introduction question

**URL:** <https://forum.freecodecamp.org/t/basic-for-loop-introduction-question/347809>\
**Category:** General\
**Created:** [February 6, 2020, 12:08am UTC](https://forum.freecodecamp.org/t/basic-for-loop-introduction-question/347809 "2020-02-06T00:08:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kai-will19](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kai-will19/32/138063_2.png) [@kai-will19](https://forum.freecodecamp.org/u/kai-will19)\
**Post date:** [February 6, 2020, 12:08am UTC](https://forum.freecodecamp.org/t/basic-for-loop-introduction-question/347809/1 "2020-02-06T00:08:38Z")

</div>

Hello fellow coders, I am currently trying to wrap my head around something but it just doesn’t make sense to me. I am currently doing for loops on FCC and I can’t understand why in the below challenge ‘i’ has to be greater than 0 instead of 1 to return(push) the final number to the array ((i \> 0), you can also write it as i \>=1). The challenge is not difficult but what is on my mind is why does the code not execute ‘1’ as the final number in the loop if you - for example - put i \> 1. The final number that is pushed is ‘3’. But 3 is still greater than 1. So why does it not push 1 as the final number in the array. I did think maybe because at the end of the loop it evaluates that 1 is not greater than 1 but the previous information that was covered in a previous lesson/challenge is that the “middle section” (condition) is already evaluated first and the loop will execute as long as the condition is true (and of course, if i = 3 then it should execute), right? Or am I missing something? The challenge example and my code is shown in the below example. If you put 1 in i \> x then it just returns [9, 7, 5, 3].

Many Thanks

```auto
// Example
var ourArray = [];

for (var i = 10; i > 0; i -= 2) {
  ourArray.push(i);
}

// Setup - My code
var myArray = [];

for(var i = 9; i > 1; i -= 2) {
  myArray.push(i);
}
console.log(myArray);
// Only change code below this line.

```

---

<div class="post-metadata">

**Author:** ![camperextraordinaire](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@camperextraordinaire](https://forum.freecodecamp.org/u/camperextraordinaire)\
**Post date:** [February 6, 2020, 12:14am UTC](https://forum.freecodecamp.org/t/basic-for-loop-introduction-question/347809/2 "2020-02-06T00:14:30Z")

</div>

As the for loop progresses, i will have the following values at the time the for loop condition (i \> 1) is evaluated. Only if i \> 1, will the value of i get pushed into myArray.

```auto
9
7
5
3
1 

```

When i becomes 1, is 1 \> 1? No, it is not, so it will not get pushed int myArray.

---

<div class="post-metadata">

**Author:** ![kai-will19](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kai-will19/32/138063_2.png) [@kai-will19](https://forum.freecodecamp.org/u/kai-will19)\
**Post date:** [February 6, 2020, 12:17am UTC](https://forum.freecodecamp.org/t/basic-for-loop-introduction-question/347809/3 "2020-02-06T00:17:39Z")

</div>

Ah I see, it appears I got too involved in what the code is doing and what is meant to actually happen when it executes. Thanks very much!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 7:36pm UTC](https://forum.freecodecamp.org/t/basic-for-loop-introduction-question/347809/4 "2021-06-01T19:36:55Z")

</div>

Closed on June 1, 2021, 7:36pm UTC


