Keeping your mind in check is very important if you want to stay productive. However, research indicates that most people find it difficult to do this—if a temptation presents itself when you are challenged by a demanding cognitive task (one that requires your focus), you are very likely to yield to the temptation. This will result in your attention being drawn away from the task at hand, and your productivity levels will decrease.
It is therefore very important that you learn how to keep your mind in your control.
Distract yourself from temptation.
Keep your attention away from temptation by any means possible. For example, if you are trying to stick to a diet and you see a sinful chocolate cake staring at you from the window of a cafe, walk away immediately.