Why does a for loop with a semicolon after it still execute?

前端 未结 4 1601
离开以前
离开以前 2020-12-21 13:42

I was having a look at some code a friend did and stumbled across this line which I thought was an error (simplified for example)..

for (g = 0; 10 > g; g+         


        
4条回答
  •  春和景丽
    2020-12-21 14:39

    your for loop runs 10 times but wont alert anything since you have put ;

    that alert you are getting is only once because of that statement outside of for loop

提交回复
热议问题