[Solved] For and While Loops (Infinite Loop)


I am trying to get it so that it counts to 100 (I cant think of anything else), and then it uses for for loop to output 100, but I ran into an infinite loop.

var lol = true
var x = 0
while (lol)
    x = x+1
    if (x>=100)
    lol === false
for(var i = 1; i<=100; i++){


To break out of the while loop, you have to set "lol" to false. Do that by lol = false. Don't use "===", that is only used for comparison. Also make sure your if statement syntax is correct and you use your semicolons.


Thanks for your help, solved the issue.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.