Basic For loop

Is it possible in for loop that the initial value of x, for example, is 1 and when it loops back x will be 2 then will be 1 again in next loop? and i will also be the one to choose if how many times they will be shown alternately.
Last edited on
Is it possible in for loop that the initial value of x, for example, is 1 and when it loops back x will be 2 then will be 1 again in next loop?

that just sounds like an infinite loop

and i will also be the one to choose if how many times they will be shown alternately.

with a counter
i'm asking that because i'm trying to make a tic tac toe game. and the players turn are alternate ..
x=(x%2)+1;
thanks bro !
Topic archived. No new replies allowed.