If you've ever written software, you know that if-then statements are the building blocks of any program. That same logic can work on yourself. Using simple if-then or when-then constructs, you can change your own habits.