Jump to content

continue in loop


Matej

Recommended Posts

 

var x=0;for(var i=0;i<10;i++){    if(i%5==0){continue}    x++;}alert(x)

 

why does x=8 here? shouldnt be it 9? when i=5 the loop exits(omiting increment) and continues which means when i=5 x=5 also , so x should have end as 9.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...