If (variable) = 0, do this / If (variable) = 1, do this?

here is an another forum post wich is deals with a similar problem:

the task is not exactly the same, so you need to adapt to yours, but the logic behind is what are you need.