How to increment number when zero?

I have a variable which equals 100 which I want to reduce by 1 then if the variable reaches 0 I want it to increment by 1, but however when it reaches 0 it adds 1 then it minuses again which I don’t want until the variable is actually 100.

I’m using a Set Timer by Event to add and minus the variable.

How can I fix this?

Thank you

if variable equal 1 case.

variable(1) add (1) equal variable(2)

clamp the variable(2) to 0~1 is variable(1)

why call clamp node 0~1?

There is a lot wrong with your code. This is the worse possible approximation of what you are trying to do.

This is the way you should do it.

Either is viable, less branches is better.