Here is my code
int i = 0;
while (i < 10)
{
i++;
i = i % 10;
}
The above code resets the counter to 0 when it reaches the limit.
Just wanted to Is there a way to do some thing similar in the below code replacing the if condition
int i = 10;
while (i > -1)
{
i--;
if (i == -1)
i = 10;
}
Both your loops are
while(true)so they play no role in the question.That leaves: “can I make a count-down roll over without an if?”
The answer is yes, if you realy want to: