I don't use continue often but doesn't it break the loop iteration? Meaning that would lead to an infinite loop in the while example because i would not get incremented.
Yeah, i forgot that point, if you're using a while loop, you should increment i before the if statement. otherwise, it will create an infinite loop. If you're using a for loop, the code i wrote above is OK
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I don't use continue often but doesn't it break the loop iteration? Meaning that would lead to an infinite loop in the while example because i would not get incremented.
Yeah, i forgot that point, if you're using a while loop, you should increment
i
before the if statement. otherwise, it will create an infinite loop. If you're using a for loop, the code i wrote above is OK