This is a simple one (I guess)
I just wondered if there is any way to make a variable (Let's say int
) cycle through a range?
Right now this is what I would do:
int someInt = 0, max = 10;
while(1) // This loop is here just for increasing someInt
{
someInt++;
if (someInt >= max)
someInt = 0;
}
Isn't there any other trick to reset someInt
? maybe without using if
?
Thanks!