it easy "switch" between 0 , 1 in following way:
int = 0; = (++i) % 2; // = 1 = (++i) % 2; // = 0 similarly, found possible "switch" between 3 , 5:
int = 3; = (((i * 2) - 1) % 3) + 3; // = 5 = (((i * 2) - 1) % 3) + 3; // = 3 whereas feels cumbersome, searching more concise way it. can simplified? if so, how? using something, way.
much shorter:
int = 3; = 8 - i; = 8 - i; and of course, 0/1 toggle, should this:
int = 0; = 1 - i; = 1 - i; and in general, a/b toggle, this:
int = a; = (a + b) - i; = (a + b) - i; how work? well, a + b - a b, , a + b - b a. :-d