# 8/13 for loop condition

#1

Hello People,

it is about to count from 100 to bigger than 0 with a decremental step of 5:

``````for (i = 100; i <= 5; i -= 5) {
console.log(i);   //Error
}``````

This code example causes: "Oops, try again. Your loop didn't log 100 to the console!"

``````for (i = 100; i >= 1; i -= 5) {
console.log(i);
}``````

This one is working. Can someone explain to me, why is that? :smile

#2
``````for(i = 100; i <= 5; i-= 5) {
console.log(i);
}``````

i = 100. The top one is basically saying (while i is less than or equal to 5, minus 5). It won't work because i is not less than or equal to 5. It's more than 5, it should be

``````for(i = 100; i >= 5; i-= 5) {
console.log(i);
}``````

#3

Does not make any sense had the exact same code and didn't work

#4

For short exercises all codes look pretty similar which does not necessarily mean that they are the same. If you have a question about your code please open a new question with a meaningful title (e.g exercise number + error message) and post your code their.

#5

The instructions said by increments of five. It may work, but it won't read it for this specific exercise.

#6

count down from 100 until 0 by 5. Thats pretty weird since your code only counts till 5 and it should count till 0.

#7

my problem

for ( var i = 100;i > 1 ; i-=5)
{
console.log(i)
};

i do not know what is wrong
just does not work for some reason , i have tried refreshing it

#8

Seems to be ok from the syntax. Maybe as @tristanstage mentioned it only goes till 5 not including 0.