Introduction to For Loops #8


This piece of code is not working... The problem exclaimed is "Oops, try again. Your loop didn't log 100 to the console!". I'm not sure why this doesn't work and would love to find a solution.

// Write your very own for loop!
for (var i = 100; i < 0 ; i-= 5) 


Have a look at your condition. A loop only runs if the condition is true. Your loop starts with i = 100 and you condition is i < 0. Obviously 100 < 0 is false so the loop doesn't even start. Instead you could use i >0 which would stop if i becomes 0.


Oohhhhhhhhhh color :smiley:

Anyways, instead of i < 0, I think you have to do i > 0.


Yeah this can be done by doing this:

here goes your code


Sorry to inform that it just crashes my browser. I'll figure it out but thanks for trying to help. :smile:


it worked when i did it like this.

i >= 1