Reset Integer

how can i reset an integer value, i have already clamped it but the problem is that when i say the minimum is 0 and the maximum is 3 then it goes only to 3 but it wont reset itself to 0.

if you want an integer to loop around, instead of using clamp, you should use the modulus operator, which gives you the remainder after division.

lets say X equals 11.
"X modulus 4" would return a 3, because 11 divided by 4 is "2 remainder 3", and modulus only returns the remainder.

so if your integer is X, and you want to keep it looping between 0 and 3, you can set X to equal “X mod 4” or

X = X % 4;

thank you, that worked