Branch check vs Set Variable Performance?

For example: when I want to set X=1 I don’t know what X equal to but X might equal to 1 ,do I just set X=1 or perform a branch check on if X==1 if not set X=1. which is better?

Thank you.

Just set it to 1. If you check and then set, that’s two operations.