3. For or While


Does anyone has an idea why this simple for loop doesn't work?

for(var i=0; i<100; i+20){

it stucks like infinite loop.


that is because it is infinity loop, the problem is in this bit:


you now tell them: check if i + 20 (0 + 20) is less then 100, which it is. You want to update i:

i = i + 20

or a shorthand:

i += 20


thanks man,

what is the code if i want i to jump in 20?


i+=20 will increases i in steps by adding 20 each time and updating the variable